Fri, 28 Mar 2025 10:34:40 -0500
Added tag v0.1.0 for changeset 680e7ec7c7f8
| 59 | 1 | %% jnsao.cls |
| 2 | %% Copyright (c) Christian Clason and Tuomo Valkonen, 2019-2025. | |
| 3 | % | |
| 4 | % LaTeX class file for articles in the | |
| 5 | % | |
| 6 | % Journal of Nonsmooth Analysis and Optimization | |
| 7 | % | |
| 8 | % Web: http://jnsao.episciences.org | |
| 9 | % E-mail: jnsao@episciences.org | |
| 10 | % | |
| 11 | % This work may be distributed and/or modified under the | |
| 12 | % conditions of the LaTeX Project Public License, either version 1.3c | |
| 13 | % of this license or (at your option) any later version. | |
| 14 | % The latest version of this license is in the file | |
| 15 | % | |
| 16 | % http://www.latex-project.org/lppl.txt | |
| 17 | % | |
| 18 | % This file is part of the "JNSAO journal template" (The work in LPPL) | |
| 19 | % and all files in that bundle must be distributed together. | |
| 20 | % | |
| 21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 22 | ||
| 23 | \NeedsTeXFormat{LaTeX2e} | |
| 24 | \ProvidesClass{jnsao}[2025/01/28 v0.12 JNSAO article] | |
| 25 | ||
| 26 | \ProcessOptions\relax | |
| 27 | ||
| 28 | \LoadClass[ | |
| 29 | a4paper, | |
| 30 | fontsize=11pt, | |
| 31 | oneside | |
| 32 | ]{scrartcl} | |
| 33 | \KOMAoptions{DIV=12} | |
| 34 | ||
| 35 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 36 | % Define colors | |
| 37 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 38 | \RequirePackage[svgnames]{xcolor} | |
| 39 | \definecolor{hrefcolor}{rgb}{0.0,0.4,0.7} | |
| 40 | \definecolor{citecolor}{rgb}{0.0,0.35,0.2} | |
| 41 | \definecolor{structure}{rgb}{0.09,0.09,0.44} | |
| 42 | \definecolor{halfgray}{gray}{0.55} | |
| 43 | ||
| 44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 45 | % Load amsmath, amsthm, thmtools, mathtools, hyperref (in this order!) | |
| 46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 47 | \RequirePackage[leqno,tbtags]{amsmath} % This *must* be *before* cleveref! | |
| 48 | \RequirePackage{amsthm} | |
| 49 | \RequirePackage{thmtools} | |
| 50 | \RequirePackage[centercolon]{mathtools} | |
| 51 | \numberwithin{equation}{section} % This *must* be *before* cleveref! | |
| 52 | ||
| 53 | \RequirePackage[ | |
| 54 | colorlinks=true, | |
| 55 | linkcolor=citecolor, | |
| 56 | citecolor=citecolor, | |
| 57 | filecolor=hrefcolor, | |
| 58 | urlcolor=hrefcolor, | |
| 59 | pdfencoding=auto, | |
| 60 | hypertexnames=false, | |
| 61 | ]{hyperref} | |
| 62 | ||
| 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 64 | % Load and set up fonts | |
| 65 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 66 | \RequirePackage[T1]{fontenc} | |
| 67 | \RequirePackage[proportional]{libertine} | |
| 68 | \RequirePackage[libertine,liby,vvarbb]{newtxmath} | |
| 69 | \RequirePackage[scaled=0.95,varqu,varl]{inconsolata} | |
| 70 | \useosf | |
| 71 | \frenchspacing | |
| 72 | \RequirePackage[kerning,spacing]{microtype} | |
| 73 | ||
| 74 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 75 | % Format: title, sectioning in colored sans smallcaps | |
| 76 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 77 | \renewcommand*{\sectfont}{\color{structure}\sffamily} | |
| 78 | \setkomafont{title}{\color{structure}\normalfont\sffamily\scshape} | |
| 79 | \setkomafont{author}{\large\normalfont\sffamily} | |
| 80 | \setkomafont{date}{\large\normalfont\sffamily} | |
| 81 | \addtokomafont{section}{\scshape} | |
| 82 | \addtokomafont{subsection}{\scshape} | |
| 83 | \addtokomafont{subsubsection}{\scshape\itshape} | |
| 84 | %\addtokomafont{footnote}{\sffamily} | |
| 85 | ||
| 86 | % title in small caps (requires lowercasing, label abstract | |
| 87 | \RequirePackage[overload]{textcase} | |
| 88 | ||
| 89 | % Prefix appendices with "Appendix" | |
| 90 | \newcommand{\jnsao@appname}{\relax} | |
| 91 | \newcommand*{\appendixmore}{% | |
| 92 | \renewcommand{\jnsao@appname}{Appendix~} | |
| 93 | \renewcommand{\thesection}{{\scshape\alph{section}}} | |
| 94 | } | |
| 95 | ||
| 96 | % section headers in small caps (requires lowercasing) | |
| 97 | \renewcommand*\sectionformat{\MakeLowercase{\jnsao@appname\thesection}\enskip} | |
| 98 | \renewcommand*\subsectionformat{\MakeLowercase{\jnsao@appname\thesubsection}\enskip} | |
| 99 | \renewcommand*\subsectionformat{\MakeLowercase{\jnsao@appname\thesubsection}\enskip} | |
| 100 | \renewcommand*\subsubsectionformat{\upshape\MakeLowercase{\jnsao@appname\thesubsubsection}\enskip} | |
| 101 | ||
| 102 | \let\jnsao@old@section\section | |
| 103 | \renewcommand*{\section}{% | |
| 104 | \@ifstar {\star@section}{\@dblarg\nonstar@section}% | |
| 105 | } | |
| 106 | \newcommand*{\star@section}[1]{% | |
| 107 | \jnsao@old@section*{\MakeLowercase{#1}}% | |
| 108 | } | |
| 109 | \newcommand*{\nonstar@section}[2][]{% | |
| 110 | \jnsao@old@section[{#1}]{\MakeLowercase{#2}}% | |
| 111 | } | |
| 112 | \let\jnsao@old@subsection\subsection | |
| 113 | \renewcommand*{\subsection}{% | |
| 114 | \@ifstar {\star@subsection}{\@dblarg\nonstar@subsection}% | |
| 115 | } | |
| 116 | \newcommand*{\star@subsection}[1]{% | |
| 117 | \jnsao@old@subsection*{\MakeLowercase{#1}}% | |
| 118 | } | |
| 119 | \newcommand*{\nonstar@subsection}[2][]{% | |
| 120 | \jnsao@old@subsection[{#1}]{\MakeLowercase{#2}}% | |
| 121 | } | |
| 122 | \let\jnsao@old@subsubsection\subsubsection | |
| 123 | \renewcommand*{\subsubsection}{% | |
| 124 | \@ifstar {\star@subsubsection}{\@dblarg\nonstar@subsubsection}% | |
| 125 | } | |
| 126 | \newcommand*{\star@subsubsection}[1]{% | |
| 127 | \jnsao@old@subsubsection*{\MakeLowercase{#1}}% | |
| 128 | } | |
| 129 | \newcommand*{\nonstar@subsubsection}[2][]{% | |
| 130 | \jnsao@old@subsubsection[{#1}]{\MakeLowercase{#2}}% | |
| 131 | } | |
| 132 | ||
| 133 | % Format (sub) figure labels | |
| 134 | \RequirePackage[labelfont={color=structure,sf}]{caption} | |
| 135 | \RequirePackage[labelfont={color=structure,sf}]{subcaption} | |
| 136 | ||
| 137 | % Url | |
| 138 | \renewcommand{\UrlFont}{\normalfont\sffamily} | |
| 139 | ||
| 140 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 141 | % Format of theorem-like environments. | |
| 142 | % These used to have to be *after* the loading of cleveref, but no longer | |
| 143 | % (2018-12-15) seems to be the case. | |
| 144 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 145 | ||
| 146 | \def\jnsao@thmformat{\NAME~{\scshape{\NUMBER}}\NOTE} | |
| 147 | ||
| 148 | \declaretheoremstyle[ | |
| 149 | headfont={\upshape\sffamily\color{structure}}, | |
| 150 | headformat=\jnsao@thmformat, | |
| 151 | bodyfont={\normalfont\itshape}, | |
| 152 | ]{plain} | |
| 153 | ||
| 154 | \declaretheoremstyle[ | |
| 155 | headfont={\upshape\sffamily\color{structure}}, | |
| 156 | headformat=\jnsao@thmformat, | |
| 157 | bodyfont={\normalfont\upshape}, | |
| 158 | ]{definition} | |
| 159 | ||
| 160 | \declaretheoremstyle[ | |
| 161 | headfont={\upshape\sffamily\color{structure}}, | |
| 162 | headformat=\jnsao@thmformat, | |
| 163 | bodyfont={\normalfont\upshape}, | |
| 164 | ]{remark} | |
| 165 | ||
| 166 | % Define basic theorem-like environments | |
| 167 | \theoremstyle{plain} | |
| 168 | \newtheorem{theorem}{Theorem}[section] | |
| 169 | \newtheorem{proposition}[theorem]{Proposition} | |
| 170 | \newtheorem{corollary}[theorem]{Corollary} | |
| 171 | \newtheorem{lemma}[theorem]{Lemma} | |
| 172 | ||
| 173 | \theoremstyle{remark} | |
| 174 | \newtheorem{remark}[theorem]{Remark} | |
| 175 | ||
| 176 | \theoremstyle{definition} | |
| 177 | \newtheorem{definition}[theorem]{Definition} | |
| 178 | \newtheorem{example}[theorem]{Example} | |
| 179 | ||
| 180 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 181 | % Footnotes: separation, special format for \thanks | |
| 182 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 183 | ||
| 184 | % Store length in base font size | |
| 185 | \newlength{\jnsao@footnotesep} | |
| 186 | \newlength{\jnsao@footnotetopsep} | |
| 187 | \newlength{\jnsao@standardfootins} | |
| 188 | \setlength{\jnsao@footnotesep}{0.5\baselineskip} | |
| 189 | \setlength{\jnsao@footnotetopsep}{\jnsao@footnotesep} | |
| 190 | \setlength{\jnsao@standardfootins}{\jnsao@footnotesep+\baselineskip} | |
| 191 | \setlength{\footnotesep}{\baselineskip} | |
| 192 | ||
| 193 | % Footnote rule for other pages than the first page | |
| 194 | \def\jnsao@footnoterule{\relax% | |
| 195 | \vskip-\jnsao@footnotesep% | |
| 196 | {\color{gray}\hrule\@width 1cm}% | |
| 197 | \vskip\jnsao@footnotetopsep% | |
| 198 | }% | |
| 199 | ||
| 200 | % Footnote rule for the first page | |
| 201 | \def\jnsao@footnoterule@firstpage{\relax% | |
| 202 | \jnsao@headfootrule% | |
| 203 | %\vskip 2pt | |
| 204 | } | |
| 205 | ||
| 206 | % Change font for \thanks | |
| 207 | \def\thanks#1{\footnotemark | |
| 208 | \protected@xdef\@thanks{\@thanks | |
| 209 | \protect\jnsao@thankstext[\the\c@footnote]{\sffamily #1}}% | |
| 210 | } | |
| 211 | \def\jnsao@thankstext{\sffamily% | |
| 212 | \@ifnextchar [\@xfootnotenext | |
| 213 | {\protected@xdef\@thefnmark{\thempfn}% | |
| 214 | \@footnotetext}} | |
| 215 | ||
| 216 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 217 | % Vertical alignment. This hacks and wraps \@outputpage and | |
| 218 | % and latex.ltx limitations to have different geometry for | |
| 219 | % the first page | |
| 220 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 221 | ||
| 222 | % Flush to bottom | |
| 223 | \flushbottom | |
| 224 | ||
| 225 | % Various lengths | |
| 226 | \newlength{\jnsao@fullheight} | |
| 227 | \newlength{\jnsao@headsep} | |
| 228 | \newlength{\jnsao@firstpagehead} | |
| 229 | \newlength{\jnsao@firstpageheadplus} | |
| 230 | \newlength{\jnsao@headheight} | |
| 231 | \newlength{\jnsao@headlineheight} | |
| 232 | ||
| 233 | % Maximum available space for text, header, and footer | |
| 234 | \setlength{\jnsao@fullheight}{\textheight+\footskip+\headheight+\headsep} | |
| 235 | % Space between header and text | |
| 236 | \setlength{\jnsao@headsep}{\baselineskip} | |
| 237 | % Height of text lines in header/footer font | |
| 238 | \setlength{\jnsao@headlineheight}{11pt} | |
| 239 | % First page header height | |
| 240 | \setlength{\jnsao@firstpagehead}{2\jnsao@headlineheight} | |
| 241 | % ... plus extra for rule and separation | |
| 242 | \setlength{\jnsao@firstpageheadplus}{\jnsao@firstpagehead+2.4pt} | |
| 243 | % Other pages header (and footer) height plus extra for rule and separation | |
| 244 | \setlength{\jnsao@headheight}{\jnsao@headlineheight+2.4pt} | |
| 245 | ||
| 246 | % Recalculate header, footer, and text area heights from: | |
| 247 | % #1: header material height | |
| 248 | % #2: header separator white space | |
| 249 | % #3: footer material height | |
| 250 | % #4: footer separator white space | |
| 251 | \def\jnsao@setheadfoot#1#2#3#4{% | |
| 252 | \global\headheight=#1% | |
| 253 | \global\headsep=#2% | |
| 254 | \global\footskip=#3% | |
| 255 | \global\advance\footskip by #4% | |
| 256 | \global\footheight=#3% KOMA-script seems to blow up things without this | |
| 257 | \global\textheight=\jnsao@fullheight% | |
| 258 | \global\advance\textheight by -\footskip% | |
| 259 | \global\advance\textheight by -\headheight% | |
| 260 | \global\advance\textheight by -\headsep% | |
| 261 | } | |
| 262 | ||
| 263 | % First page settings | |
| 264 | \setlength{\skip\footins}{\jnsao@footnotesep+0.5\splittopskip} | |
| 265 | \let\footnoterule\jnsao@footnoterule@firstpage | |
| 266 | \jnsao@setheadfoot{\jnsao@firstpageheadplus}{\jnsao@headsep}{0em}{0em} | |
| 267 | ||
| 268 | % Other pages' settings | |
| 269 | \def\jnsao@geometry@otherpages{% | |
| 270 | % Set up geometry of following pages | |
| 271 | \global\skip\footins=\jnsao@standardfootins | |
| 272 | \global\let\footnoterule\jnsao@footnoterule | |
| 273 | \jnsao@setheadfoot{\jnsao@headheight}{\jnsao@headsep}{\jnsao@headheight}{\jnsao@headsep} | |
| 274 | } | |
| 275 | ||
| 276 | % \@outputpage hack to reset settings after first page | |
| 277 | \let\jnsao@old@outputpage\@outputpage | |
| 278 | \def\jnsao@output@firstpage{ | |
| 279 | \jnsao@old@outputpage% | |
| 280 | \jnsao@geometry@otherpages% | |
| 281 | % This is needed for something to actually happen after the reset above, | |
| 282 | % as standard \@outputpage does the same thing at the end | |
| 283 | \global\@colht\textheight% | |
| 284 | % Reset page output routine | |
| 285 | \global\let\jnsao@output@page\jnsao@old@outputpage% | |
| 286 | } | |
| 287 | ||
| 288 | \def\@outputpage{\jnsao@output@page} | |
| 289 | \let\jnsao@output@page\jnsao@output@firstpage | |
| 290 | ||
| 291 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 292 | % Date | |
| 293 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 294 | ||
| 295 | \RequirePackage{scrdate} | |
| 296 | \date{\ISOToday} | |
| 297 | ||
| 298 | % Over-ride \today with \ISOdate when we insert it. This is needed because Babel | |
| 299 | % reset \date{\ISOToday} into a locale format. | |
| 300 | \def\jnsao@insertdate{{\let\today\ISOToday\@date}} | |
| 301 | %\def\date#1{\gdef\@date{\let\today\ISOToday#1}} | |
| 302 | ||
| 303 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 304 | % Publication information | |
| 305 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 306 | ||
| 307 | \let\jnsao@submitted\empty | |
| 308 | \let\jnsao@accepted\empty | |
| 309 | \let\jnsao@journal\empty | |
| 310 | \let\jnsao@volume\empty | |
| 311 | \let\jnsao@number\empty | |
| 312 | \let\jnsao@year\empty | |
| 313 | \let\jnsao@doi\empty | |
| 314 | \let\jnsao@eprinttype\empty | |
| 315 | \let\jnsao@eprint\empty | |
| 316 | \let\jnsao@shortauthor\empty | |
| 317 | \let\jnsao@shorttitle\empty | |
| 318 | \let\jnsao@ack\empty | |
| 319 | \def\jnsao@journal{Journal of Nonsmooth Analysis and Optimization} | |
| 320 | \def\jnsao@journalabbrev{J.~Nonsmooth Anal.~Optim.} | |
| 321 | \def\jnsao@license{CC-BY-SA 4.0} | |
| 322 | \def\jnsao@copyright{{\copyright} the authors} | |
| 323 | \def\jnsao@status{Manuscript} | |
| 324 | ||
| 325 | \newcommand{\manuscriptsubmitted}[1]{\gdef\jnsao@submitted{#1}} | |
| 326 | \newcommand{\manuscriptaccepted}[1]{\gdef\jnsao@accepted{#1}} | |
| 327 | \newcommand{\manuscriptvolume}[1]{\gdef\jnsao@volume{#1}} | |
| 328 | \newcommand{\manuscriptnumber}[1]{\gdef\jnsao@number{#1}} | |
| 329 | \newcommand{\manuscriptjournal}[1]{\gdef\jnsao@journal{#1}} | |
| 330 | \newcommand{\manuscriptlicense}[1]{\gdef\jnsao@license{#1}} | |
| 331 | \newcommand{\manuscriptcopyright}[1]{\gdef\jnsao@copyright{#1}} | |
| 332 | \newcommand{\manuscriptyear}[1]{\gdef\jnsao@year{#1}} | |
| 333 | \newcommand{\manuscriptdoi}[1]{\gdef\jnsao@doi{#1}} | |
| 334 | \newcommand{\manuscripteprinttype}[1]{\gdef\jnsao@eprinttype{#1}} | |
| 335 | \newcommand{\manuscripteprint}[1]{\gdef\jnsao@eprint{#1}} | |
| 336 | \newcommand{\manuscriptstatus}[1]{\gdef\jnsao@status{#1}} | |
| 337 | \newcommand{\shortauthor}[1]{\gdef\jnsao@shortauthor{#1}} | |
| 338 | \newcommand{\shorttitle}[1]{\gdef\jnsao@shorttitle{#1}} | |
| 339 | \newcommand{\acknowledgements}[1]{\gdef\jnsao@ack{#1}} | |
| 340 | \newcommand{\acknowledgments}[1]{\gdef\jnsao@ack{#1}} | |
| 341 | ||
| 342 | \def\jnsao@licenseurl#1#2{% | |
| 343 | \expandafter\def\csname jnsao@licenseurl@#1 \endcsname{#2}% | |
| 344 | } | |
| 345 | ||
| 346 | \RequirePackage{xstring} | |
| 347 | \def\jnsao@printeprint{% | |
| 348 | % lowercase is not expandable, so we have to be tricky (https://tex.stackexchange.com/a/87130) | |
| 349 | \lowercase\expandafter{\expandafter\def\expandafter\@tempe\expandafter{\jnsao@eprinttype}}% | |
| 350 | \IfStrEqCase{\@tempe}{% | |
| 351 | {arxiv}{\arxiv{\jnsao@eprint}}% | |
| 352 | {hal}{\hal{\jnsao@eprint}}% | |
| 353 | }[{\sffamily \textsc{\MakeLowercase{\jnsao@eprinttype:}}\,\jnsao@eprint}]% | |
| 354 | } | |
| 355 | \jnsao@licenseurl{CC-BY}{https://creativecommons.org/licenses/by/4.0/} | |
| 356 | \jnsao@licenseurl{CC-BY 4.0}{https://creativecommons.org/licenses/by/4.0/} | |
| 357 | \jnsao@licenseurl{CC-BY-SA}{https://creativecommons.org/licenses/by-sa/4.0/} | |
| 358 | \jnsao@licenseurl{CC-BY-SA 4.0}{https://creativecommons.org/licenses/by-sa/4.0/} | |
| 359 | \jnsao@licenseurl{CC-BY-NC-SA}{https://creativecommons.org/licenses/by-nc-sa/4.0/} | |
| 360 | \jnsao@licenseurl{CC-BY-NC-SA 4.0}{https://creativecommons.org/licenses/by-nc-sa/4.0/} | |
| 361 | \jnsao@licenseurl{CC-BY-NC}{https://creativecommons.org/licenses/by-nc/4.0/} | |
| 362 | \jnsao@licenseurl{CC-BY-NC 4.0}{https://creativecommons.org/licenses/by-nc/4.0/} | |
| 363 | \jnsao@licenseurl{CC-BY-NC-ND}{https://creativecommons.org/licenses/by-nc-nd/4.0/} | |
| 364 | \jnsao@licenseurl{CC-BY-NC-ND 4.0}{https://creativecommons.org/licenses/by-nc-nd/4.0/} | |
| 365 | ||
| 366 | \def\jnsao@linklicense#1{% | |
| 367 | \ifcsname jnsao@licenseurl@#1 \endcsname% | |
| 368 | \expandafter\let\expandafter\@tempa\csname jnsao@licenseurl@#1 \endcsname% | |
| 369 | \href{\@tempa}{\scshape \MakeLowercase{#1}}% | |
| 370 | \else% | |
| 371 | #1% | |
| 372 | \fi | |
| 373 | } | |
| 374 | ||
| 375 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 376 | % Headers and footers | |
| 377 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 378 | ||
| 379 | \RequirePackage{lastpage} | |
| 380 | \RequirePackage[fit]{truncate} | |
| 381 | ||
| 382 | \addtokomafont{pageheadfoot}{\normalfont\sffamily\footnotesize} | |
| 383 | ||
| 384 | \def\jnsao@headfootrule{\hrule width \textwidth height 0.4pt} | |
| 385 | \def\jnsao@ruledhead#1{\vbox to \headheight{\usekomafont{pageheadfoot}\hbox to \textwidth{#1}\vskip 2pt\jnsao@headfootrule\vfill}} | |
| 386 | \def\jnsao@ruledfoot#1{\vbox to \footheight{\usekomafont{pageheadfoot}\vfill\jnsao@headfootrule\vskip 2pt\hbox to \textwidth{#1}}} | |
| 387 | ||
| 388 | \def\ps@jnsao{% | |
| 389 | \def\@oddhead{\jnsao@ruledhead{% | |
| 390 | \ifx\jnsao@accepted\empty{% | |
| 391 | \ifx\jnsao@eprint\empty{% | |
| 392 | \jnsao@status, \jnsao@insertdate% | |
| 393 | }\else{% | |
| 394 | \jnsao@printeprint, \jnsao@insertdate% | |
| 395 | }\fi% | |
| 396 | }\else{% | |
| 397 | \jnsao@journalabbrev% | |
| 398 | \ifx\jnsao@volume\empty{\relax}\else{ \jnsao@volume}\fi% | |
| 399 | \ifx\jnsao@year\empty{\relax}\else{ (\jnsao@year)}\fi% | |
| 400 | \ifx\jnsao@number\empty{\relax}\else{, \jnsao@number}\fi% | |
| 401 | }\fi% | |
| 402 | \hfill% | |
| 403 | page~\thepage~of~\pageref*{LastPage}% | |
| 404 | }} | |
| 405 | \def\@oddfoot{\jnsao@ruledfoot{% | |
| 406 | \truncate{0.5\textwidth}{\ifx\jnsao@shortauthor\empty{}\else{\jnsao@shortauthor}\fi}% | |
| 407 | \hfill% | |
| 408 | \truncate{0.5\textwidth}{\ifx\jnsao@shorttitle\empty{\@title}\else{\jnsao@shorttitle}\fi}% | |
| 409 | }} | |
| 410 | } | |
| 411 | ||
| 412 | \pagestyle{jnsao} | |
| 413 | ||
| 414 | \def\ps@jnsaotitlepage{% | |
| 415 | \def\@oddhead{\jnsao@ruledhead{% | |
| 416 | \parbox[b][\jnsao@firstpagehead][t]{0.75\textwidth}{% | |
| 417 | \ifx\jnsao@accepted\empty{% | |
| 418 | \ifx\jnsao@eprint\empty{% | |
| 419 | \jnsao@status\\ | |
| 420 | date: \jnsao@insertdate \\ | |
| 421 | }\else{% | |
| 422 | \jnsao@printeprint\\ | |
| 423 | date: \jnsao@insertdate \\ | |
| 424 | }\fi% | |
| 425 | }\else{% | |
| 426 | \jnsao@journalabbrev% | |
| 427 | \ifx\jnsao@volume\empty{\relax}\else{ \jnsao@volume}\fi% | |
| 428 | \ifx\jnsao@year\empty{\relax}\else{ (\jnsao@year)}\fi% | |
| 429 | \ifx\jnsao@number\empty{\relax}\else{, \jnsao@number}\fi% | |
| 430 | \ifx\jnsao@doi\empty{\relax}\else{, \expandafter\doi\expandafter{\jnsao@doi}}\fi% | |
| 431 | \\% | |
| 432 | \ifx\jnsao@date\empty{% | |
| 433 | \ifx\jnsao@accepted\empty{\relax}\else{Accepted: \jnsao@accepted}\fi% | |
| 434 | }\else{% | |
| 435 | Submitted: \jnsao@submitted\ifx\jnsao@accepted\empty{}\else, accepted: \jnsao@accepted\fi% | |
| 436 | }\fi% | |
| 437 | \\ | |
| 438 | }\fi% | |
| 439 | }% | |
| 440 | \hfill% | |
| 441 | \parbox[b][\jnsao@firstpagehead][t]{0.25\textwidth}{% | |
| 442 | \hfill page~1~of~\pageref*{LastPage}\\% | |
| 443 | \null\hfill\jnsao@copyright | |
| 444 | \ifx\jnsao@license\empty{\relax} | |
| 445 | \else{, \jnsao@linklicense{\jnsao@license}} | |
| 446 | \fi | |
| 447 | }% | |
| 448 | }} | |
| 449 | \def\@oddfoot{} | |
| 450 | } | |
| 451 | ||
| 452 | \renewcommand{\titlepagestyle}{jnsaotitlepage} | |
| 453 | ||
| 454 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 455 | % Abstract and article title | |
| 456 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 457 | ||
| 458 | % \maketitle customisations: | |
| 459 | % - Locally convert \@title to lower case for ``all small caps'' to work right | |
| 460 | % - Reset \@date to stop babel from messing things up with its silly enforced | |
| 461 | % date formats. | |
| 462 | % - Include acknowledgements before \thanks footnotes | |
| 463 | % This version \@maketitle is simply based on scrartcl.cls with unsupported | |
| 464 | % features removed. | |
| 465 | ||
| 466 | \def\jnsao@insert@ack{\insert\footins{% | |
| 467 | \reset@font\footnotesize% | |
| 468 | \interlinepenalty\interfootnotelinepenalty% | |
| 469 | \splittopskip\footnotesep% | |
| 470 | \splitmaxdepth \dp\strutbox \floatingpenalty \@MM% | |
| 471 | \hsize\columnwidth \@parboxrestore% | |
| 472 | \color@begingroup% | |
| 473 | \hb@xt@1.8em{\rule\z@\footnotesep\ignorespaces\parbox[t]{\textwidth}{\jnsao@ack}\@finalstrut\strutbox}% | |
| 474 | \color@endgroup}} | |
| 475 | ||
| 476 | \renewcommand*{\@maketitle}{% | |
| 477 | \global\@topnum=\z@ | |
| 478 | \setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative | |
| 479 | \null | |
| 480 | \vskip 2em% | |
| 481 | \if\jnsao@ack\empty\else\jnsao@insert@ack\fi% | |
| 482 | \begin{center}% | |
| 483 | {\usekomafont{title}{\huge \MakeLowercase{\@title} \par}}% | |
| 484 | \vskip .5em | |
| 485 | {\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}% | |
| 486 | \vskip 1em | |
| 487 | {% | |
| 488 | \usekomafont{author}{% | |
| 489 | \lineskip .5em% | |
| 490 | \begin{tabular}[t]{c} | |
| 491 | \@author | |
| 492 | \end{tabular}\par | |
| 493 | }% | |
| 494 | }% | |
| 495 | \vskip \z@ \@plus 2em | |
| 496 | \ifx\@dedication\@empty \else | |
| 497 | \vskip 2em | |
| 498 | {\usekomafont{dedication}{\@dedication \par}}% | |
| 499 | \fi | |
| 500 | \end{center}% | |
| 501 | \par | |
| 502 | \vskip 2em | |
| 503 | }% | |
| 504 | ||
| 505 | % Set up abstract formatting | |
| 506 | \renewenvironment{abstract}{% | |
| 507 | \vspace*{-0.75cm} | |
| 508 | \small% | |
| 509 | \quotation% | |
| 510 | \noindent% | |
| 511 | {\normalfont\sectfont\nobreak\abstractname\quad}% | |
| 512 | }{% | |
| 513 | \endquotation% | |
| 514 | \vskip 0.7cm | |
| 515 | } | |
| 516 | ||
| 517 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 518 | % Possibly missing commands | |
| 519 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 520 | ||
| 521 | \providecommand{\arxiv}[1]{\mbox{\scshape\sffamily arxiv:}\,\href{https://arxiv.org/abs/#1}{#1}} | |
| 522 | \providecommand{\hal}[1]{\href{https://hal.archives-ouvertes.fr/#1}{#1}} | |
| 523 | \providecommand{\doi}[1]{\mbox{\scshape\sffamily doi:}\,\href{https://dx.doi.org/#1}{\detokenize{#1}}} | |
| 524 | \providecommand{\orcid}[1]{\mbox{\scshape\sffamily orcid:}\,\href{https://orcid.org/#1}{\detokenize{#1}}} | |
| 525 | \def\email#1{\href{mailto:#1}{\sffamily#1}} | |
| 526 | ||
| 527 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 528 | % Potential additional customizations | |
| 529 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 530 | % \RequirePackage{mdframed} | |
| 531 | % | |
| 532 | % \mdfdefinestyle{examplebg}{ | |
| 533 | % backgroundcolor=structure!7,% | |
| 534 | % hidealllines=true,% | |
| 535 | % innertopmargin=-.3em,% | |
| 536 | % innerbottommargin=.7em,% | |
| 537 | % innerleftmargin=.7em,% | |
| 538 | % innerrightmargin=.7em,% | |
| 539 | % } | |
| 540 | % | |
| 541 | % \surroundwithmdframed[style=examplebg]{example} | |
| 542 | % \surroundwithmdframed[style=examplebg]{algorithm} | |
| 543 | ||
| 544 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 545 | % Adaptations of optional packages on startup. | |
| 546 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 547 | ||
| 548 | \PassOptionsToPackage{nameinlink,capitalise}{cleveref} | |
| 549 | \AfterPackage{cleveref}{% | |
| 550 | % cleveref: tell it about the plural of Figure | |
| 551 | \crefname{figure}{Figure}{Figures} | |
| 552 | ||
| 553 | % cleveref: fix "Eq. (1)" to "(1)" | |
| 554 | \crefname{equation}{}{} | |
| 555 | ||
| 556 | % cleveref: fix "Item. (i)" to "(i)" | |
| 557 | \crefname{enumi}{}{} | |
| 558 | ||
| 559 | % fix for broken hyperref hooks on Nov-2024 kernel | |
| 560 | \AddToHook{env/proposition/begin}{\crefalias{theorem}{proposition}} | |
| 561 | \AddToHook{env/corollary/begin}{\crefalias{theorem}{corollary}} | |
| 562 | \AddToHook{env/lemma/begin}{\crefalias{theorem}{lemma}} | |
| 563 | \AddToHook{env/remark/begin}{\crefalias{theorem}{remark}} | |
| 564 | \AddToHook{env/definition/begin}{\crefalias{theorem}{definition}} | |
| 565 | \AddToHook{env/example/begin}{\crefalias{theorem}{example}} | |
| 566 | } | |
| 567 | ||
| 568 | % patch incompatible AMS environments for lineno | |
| 569 | \AfterPackage{lineno}{% | |
| 570 | \newcommand*\patchAmsMathEnvironmentForLineno[1]{% | |
| 571 | \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname | |
| 572 | \expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname | |
| 573 | \renewenvironment{#1}% | |
| 574 | {\linenomath\csname old#1\endcsname}% | |
| 575 | {\csname oldend#1\endcsname\endlinenomath}}% | |
| 576 | \newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{% | |
| 577 | \patchAmsMathEnvironmentForLineno{#1}% | |
| 578 | \patchAmsMathEnvironmentForLineno{#1*}}% | |
| 579 | \AtBeginDocument{% | |
| 580 | \patchBothAmsMathEnvironmentsForLineno{equation}% | |
| 581 | \patchBothAmsMathEnvironmentsForLineno{align}% | |
| 582 | \patchBothAmsMathEnvironmentsForLineno{flalign}% | |
| 583 | \patchBothAmsMathEnvironmentsForLineno{alignat}% | |
| 584 | \patchBothAmsMathEnvironmentsForLineno{gather}% | |
| 585 | \patchBothAmsMathEnvironmentsForLineno{multline}% | |
| 586 | } | |
| 587 | \renewcommand{\linenumberfont}{\normalfont\scriptsize\sffamily\color{gray}} | |
| 588 | \renewcommand\thelinenumber{\tabularnumsf{\arabic{linenumber}}} | |
| 589 | } | |
| 590 | ||
| 591 | ||
| 592 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 593 | % PDF metadata | |
| 594 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 595 | ||
| 596 | \AtBeginDocument{ | |
| 597 | \begingroup | |
| 598 | % Override \and and \thanks to clean up author | |
| 599 | \def\and{ and } | |
| 600 | \def\thanks#1{\relax} | |
| 601 | \hypersetup{ | |
| 602 | pdftitle = {\@title}, | |
| 603 | pdfauthor = {\@author}, | |
| 604 | } | |
| 605 | \endgroup | |
| 606 | } | |
| 607 | ||
| 608 |