pi-article.cls 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % pi-article.cls, v4.0
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. \NeedsTeXFormat{LaTeX2e}
  5. \ProvidesClass{pi-article}[08/09/2021, v5.0]
  6. \RequirePackage{etoolbox} % a necessity
  7. %%%%%%%%%%%%%%%%%%%%%% Class options and conditionals
  8. %% Toggles for various conditions and options
  9. \newtoggle{SI} % switching to SI format
  10. \newtoggle{shortintro} % will not include abstract in the title page
  11. \newtoggle{tocfig} % small figure next to the abstract
  12. \newtoggle{twocolumn} % text will be laid out in two column
  13. \newtoggle{toprule} % large line at the top
  14. \toggletrue{toprule} % on by default
  15. \newtoggle{linenumbers} % including line numbers
  16. \newtoggle{affiltop} % author affiliation at the top
  17. \newtoggle{footdate} % add current date in footer
  18. \toggletrue{footdate} % on by default
  19. \newtoggle{footpreprint} % add a "Preprint" text in footer
  20. \toggletrue{footpreprint} % on by default
  21. \newtoggle{debug} % debugging activated
  22. % Option for type of article
  23. \newcommand{\arttype}{ARTICLE}
  24. \DeclareOption{commun}{\renewcommand{\arttype}{COMMUNICATION}}
  25. \DeclareOption{review}{\renewcommand{\arttype}{REVIEW}}
  26. \DeclareOption{persp}{\renewcommand{\arttype}{PERSPECTIVE}}
  27. % Option for switching to SI format
  28. \DeclareOption{SI}{\toggletrue{SI}}
  29. % Option for two column format
  30. \DeclareOption{twocolumn}{
  31. \toggletrue{twocolumn}
  32. \PassOptionsToClass{twocolumn}{extarticle}
  33. }
  34. % Option for line numbers
  35. \DeclareOption{lineno}{\toggletrue{linenumbers}}
  36. % Option for footer
  37. \DeclareOption{nofootdate}{\togglefalse{footdate}}
  38. \DeclareOption{nofootprint}{\togglefalse{footpreprint}}
  39. % Option for affiliation location
  40. \DeclareOption{affiltop}{\toggletrue{affiltop}}
  41. % Option for toc image
  42. \DeclareOption{tocfig}{\toggletrue{tocfig}}
  43. % Option for debugging format
  44. \DeclareOption{debug}{\toggletrue{debug}}
  45. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}} % pass other options to base class
  46. \ProcessOptions*\relax % finish options
  47. \LoadClass{extarticle}
  48. %%%%%%%%%%%%%%%%%%%%%% Global settings for SI format
  49. \iftoggle{SI}{
  50. \togglefalse{toprule} % no top rule
  51. \toggletrue{shortintro} % no abstract
  52. \toggletrue{twocolumn} % single column
  53. \def\thepage{S\arabic{page}} % pages as S1-SX
  54. \renewcommand*\thefigure{S\arabic{figure}} % Figures as Fig. S1
  55. \renewcommand*\thetable{S\arabic{table}} % Tables as Table S1
  56. \renewcommand*\theequation{S\arabic{equation}} % Equations as Eq. S1
  57. \AtBeginDocument{% % Bibliographies as Ref. S1
  58. \renewcommand*\citenumfont[1]{S#1}%
  59. \renewcommand*\bibnumfmt[1]{(S#1)}%
  60. }
  61. }{}
  62. %%%%%%%%%%%%%%%%%%%%%% Fonts and language
  63. % Fonts
  64. \RequirePackage{lmodern}
  65. \renewcommand*\familydefault{\sfdefault}
  66. % Microtype
  67. \AtEndOfClass{\RequirePackage{microtype}}
  68. %% Set up main page fonts
  69. \newcommand{\headerfont}{\fontfamily{lmss}\color{gray}\bfseries\sffamily\fontsize{16pt}{20pt}\selectfont}
  70. \newcommand{\footerfont}{\normalfont\sffamily\fontsize{7pt}{9pt}\selectfont}
  71. \newcommand{\titlefont}{\fontfamily{lmss}\bfseries\fontsize{22pt}{24pt}\selectfont}
  72. \newcommand{\subtitlefont}{\fontfamily{lmss}\bfseries\fontsize{15pt}{20pt}\selectfont}
  73. \newcommand{\contactfont}{\itshape\sffamily\fontsize{7pt}{9pt}\selectfont}
  74. \newcommand{\absfont}{\normalfont\sffamily\bfseries\fontsize{8pt}{11pt}\selectfont}
  75. \newcommand{\keywordsfont}{\normalfont\sffamily\fontsize{8pt}{11pt}\selectfont}
  76. \newcommand{\footnotefont}{\normalfont\sffamily\fontsize{7}{9}\selectfont}
  77. % AMS maths packages
  78. \RequirePackage{
  79. amsmath,
  80. amsfonts,
  81. amsthm,
  82. amssymb
  83. }
  84. %% Add bolding to math where needed
  85. \g@addto@macro\bfseries{\boldmath}
  86. % Encodings
  87. \RequirePackage{ifxetex,ifluatex}
  88. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  89. \RequirePackage{cmap}
  90. \RequirePackage[TS1,T1]{fontenc}
  91. \RequirePackage[utf8]{inputenc}
  92. \else % if luatex or xelatex
  93. \ifxetex
  94. \usepackage{mathspec}
  95. % undo the wrong changes made by mathspec
  96. \let\RequirePackage\original@RequirePackage
  97. \let\usepackage\RequirePackage
  98. \else
  99. \usepackage{fontspec}
  100. \fi
  101. \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
  102. \fi
  103. % Language
  104. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  105. \RequirePackage[english]{babel}
  106. \else
  107. \usepackage{polyglossia}
  108. \setmainlanguage[]{english}
  109. \fi
  110. %%%%%%%%%%%%%%%%%%%%%% General pagination setup and tools
  111. \RequirePackage[
  112. a4paper,includeheadfoot, % paper size, head/foot included in geometry
  113. top=35pt,bottom=50pt, % top/bottom
  114. left=75pt,right=75pt, % left/right
  115. marginparwidth=2cm, % margins (used for line numbers)
  116. marginparsep=5pt, % margin separation
  117. headheight=20pt, % header height
  118. headsep=20pt, % text distance from header
  119. footskip=25pt
  120. ]{geometry}
  121. \iftoggle{twocolumn}{ % smaller margins if two-column
  122. \geometry{
  123. top=25pt,bottom=35pt, % top/bottom
  124. left=55pt,right=55pt, % left/right
  125. headsep=10pt
  126. }
  127. }{}
  128. \iftoggle{debug}{
  129. \geometry{
  130. showframe,showcrop, % for debugging
  131. }
  132. }{}
  133. \setlength{\columnsep}{13.5pt} % Distance between the two columns of text
  134. \setlength{\parindent}{12pt} % Paragraph indent
  135. \RequirePackage{changepage} % change odd/even page at any point
  136. \RequirePackage{lastpage} % Refer to last page of the document
  137. \RequirePackage{afterpage} % execute a command on next page (useful for \clearpage flush)
  138. \RequirePackage{enumitem} % For reducing bullet list item separation
  139. %%%%%%%%%%%%%%%%%%%%%% Figures, tables, equations and listings
  140. % Figures
  141. \RequirePackage{graphicx} % include pictures
  142. \RequirePackage{tikz} % drawing pictures
  143. \usetikzlibrary{svg.path} % TIKZ svg paths
  144. \usetikzlibrary{calc} % TIKZ calculations
  145. \RequirePackage[framemethod=tikz]{mdframed} % breakable framed and coloured boxes
  146. %% Set document color scheme
  147. \RequirePackage{xcolor} % driver indepentent color extensions
  148. \definecolor{black50}{gray}{0.5} % 50% black for hrules
  149. \definecolor{color0}{RGB}{0,0,0} % Base
  150. \definecolor{color1}{RGB}{59,90,198} % author email, doi
  151. % Tables
  152. \RequirePackage{
  153. booktabs, % overall nice table quality
  154. array, % better column and row definitions
  155. longtable, % for tables spanning multiple pages
  156. makecell, % multilined table cells
  157. tabularx, % width-expanding column (with 'x')
  158. multirow, % for multirow cells (with \\)
  159. colortbl % to add colours to table cells
  160. }
  161. % booktabs provide nice spacing, but rule widths and distances need modifying
  162. \setlength{\heavyrulewidth}{0.5pt} % wide rule
  163. \setlength{\lightrulewidth}{0.5pt} % light rule
  164. \setlength{\aboverulesep}{1.5pt} % blank space above rules
  165. \setlength{\belowrulesep}{1.5pt} % blank space below rules
  166. \setlength{\belowbottomsep}{5pt} % blank space below whole table
  167. \AtBeginEnvironment{tabular}{% % font inside tables will be small
  168. \sffamily\fontsize{7.5}{10}\selectfont
  169. }
  170. %% command we can use to add some text e.g. below the table
  171. \newcommand{\addtabletext}[1]{{\setlength{\leftskip}{9pt}\fontsize{7}{9}\selectfont#1}}
  172. % Code snippets/listings
  173. \RequirePackage{listings}
  174. % Equations
  175. % placed in square brackets
  176. \renewcommand\tagform@[1]{\maketag@@@ {[\ignorespaces #1\unskip \@@italiccorr ]}}
  177. % For numbering just one line of an equation
  178. \newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
  179. %%%%%%%%%%%%%%%%%%%%%% Floats, subfloats and their captions
  180. \RequirePackage{float} % improved interface for floating objects
  181. \RequirePackage{dblfloatfix} % fixes for twocolumn floats
  182. \RequirePackage{placeins} % for the floatbarrier macro
  183. % distance between floats and text
  184. \setlength{\textfloatsep}{6pt \@plus 2.0pt \@minus 2.0pt}
  185. % distance between two floats
  186. \setlength{\floatsep}{8pt \@plus 2.0pt \@minus 2.0pt}
  187. % Better captions
  188. \RequirePackage[
  189. skip=3pt, % vertical space between caption and figure
  190. labelfont={bf,sf}, % we bold the caption label
  191. labelsep=colon, % periods after label (Fig. 1:)
  192. figurename=Fig., % figure will be abbreviated
  193. % tablename=Tbl., % table will be abbreviated
  194. ]{caption}
  195. % overall font types (excluding label)
  196. \DeclareCaptionFormat{fmt}{\normalfont\sffamily\fontsize{7}{9}\selectfont#1#2#3}
  197. \captionsetup*{format=fmt} % for figures
  198. \captionsetup*[table]{format=fmt,position=above} % for tables
  199. % Subfigures
  200. \RequirePackage{subcaption}
  201. % Sidecaptions
  202. \RequirePackage[rightcaption]{sidecap}
  203. %%%%%%%%%%%%%%%%%%%%%% Utilities
  204. % Filler text
  205. \RequirePackage{lipsum}
  206. % Todo notes
  207. \RequirePackage{todonotes}
  208. %%%%%%%%%%%%%%%%%%%%%% Science-related packages
  209. % In-line fractions
  210. \RequirePackage{xfrac}
  211. % The SIunitx package enables the \SI{}{} command.
  212. \RequirePackage{siunitx}
  213. \sisetup{
  214. detect-weight=true,
  215. detect-family=true,
  216. per-mode=reciprocal,
  217. range-units=single, % brief SIrange
  218. range-phrase=-- % and using lines
  219. }
  220. % The mchem package for formula subscripts using \ce{}
  221. \RequirePackage[version=4]{mhchem}
  222. %%%%%%%%%%%%%%%%%%%%%% Bibliography, footnotes and their settings
  223. % Natbib package for text references
  224. \RequirePackage[
  225. numbers, % numbers as references
  226. merge, % merge multiple references in one
  227. super, % superscript
  228. sort&compress
  229. ]{natbib}
  230. % Moves references after punctuation
  231. \RequirePackage{natmove}
  232. \renewcommand*{\natmovechars}{.} % only after full stop
  233. % Bibliography style
  234. %% No separation between references
  235. \setlength{\bibsep}{0.0pt}
  236. %% Use pi-bib.bst as a style (if available) else fall back to unsrtnat
  237. \IfFileExists{templates/pi/pi-bib.bst}{
  238. \bibliographystyle{templates/pi/pi-bib}
  239. }{
  240. \IfFileExists{pi-bib.bst}{
  241. \bibliographystyle{pi-bib}
  242. }{
  243. \PackageWarning{pi-bib}{templates/pi/pi-bib.bst not found; must specify manually}
  244. \bibliographystyle{unsrt}
  245. }}
  246. %% set Bibliography font
  247. \renewcommand\bibfont{\normalfont\sffamily\fontsize{6}{8}\selectfont}
  248. %% Use "References" as bibliography title
  249. \renewcommand{\bibname}{References}
  250. \renewcommand{\refname}{References}
  251. \AtEndOfClass{
  252. \renewcommand{\tocbibname}{References}
  253. }
  254. %% Remove brackets from label
  255. \renewcommand\@biblabel[1]{ #1.}
  256. % Footnotes
  257. \RequirePackage[flushmargin,ragged,symbol*]{footmisc}
  258. \renewcommand*{\footnotelayout}{\footnotefont}
  259. \renewcommand{\footnoterule}{% Set the footnote hrule style
  260. \kern -3pt
  261. {\color{black50} \hrule width 72pt height 0.25pt}
  262. \kern 2.5pt
  263. }
  264. %%%%%%%%%%%%%%%%%%%%%% References and bookmarks
  265. % Xr:
  266. % To reference another document, in this case the SI
  267. \RequirePackage{xr, xr-hyper}
  268. % Hyperlinking
  269. \RequirePackage[
  270. colorlinks=true,
  271. allcolors=blue,
  272. pagebackref=false
  273. ]{hyperref}
  274. %% Set URL link color & font
  275. \renewcommand\UrlFont{\color{black}\sffamily}
  276. % References
  277. \RequirePackage[
  278. capitalise,
  279. nameinlink,
  280. ]{cleveref}
  281. % Equation reference label has no brackets
  282. \creflabelformat{equation}{#2\textup{#1}#3}
  283. \RequirePackage{doi} % DOIs
  284. \RequirePackage[nottoc]{tocbibind} % References section in TOC (for SI)
  285. %%%%%%%%%%%%%%%%%%%%%%
  286. %%%%%%%%%%%%%%%%%%%%%% Other Setup
  287. %%%%%%%%%%%%%%%%%%%%%% Author and affiliation
  288. % Keeps footnotes where they should be
  289. \RequirePackage{titling}
  290. \setlength\thanksmarkwidth{0em}
  291. \setlength\thanksmargin{-\thanksmarkwidth}
  292. % Typesetting for authors/affiliations
  293. \RequirePackage{authblk}
  294. \setlength{\affilsep}{8.5pt} % 16.5pts between base of author line and base of affil line
  295. \renewcommand\Authfont{\color{color0}\normalfont\sffamily\bfseries\fontsize{9}{11}\selectfont}
  296. \renewcommand\Affilfont{\color{color0}\footnotefont}
  297. \renewcommand\AB@affilsepx{\newline\protect\Affilfont}
  298. \renewcommand\Authands{, and }
  299. %%%%%%%%%%%%%%%%%%%%%% Author and paper metadata
  300. %% ORCID logo
  301. \definecolor{orcidlogocol}{HTML}{A6CE39}
  302. \tikzset{
  303. orcidlogo/.pic={
  304. \fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
  305. \fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
  306. svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
  307. svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
  308. }
  309. x}
  310. %% Article meta data additional fields
  311. \newcommand{\pubdoi}[1]{\def\@pubdoi{#1}} % publication DOI
  312. \newcommand{\keywords}[1]{\def\@keywords{#1}} % keywords
  313. \newcommand{\sep}[0]{; } % keyword separator
  314. \newcommand{\contact}[1]{\def\@contact{#1}} % contact author
  315. \newcommand{\leadauthor}[1]{\def\@leadauthor{#1}} % lead (first) author
  316. \newcommand{\equalcontrib}[1]{\def\@equalcontrib{#1}} % equal contribution switch
  317. \newcommand{\orcid}[1]{ % ORCID
  318. \href{https://orcid.org/#1}{\mbox{
  319. \begin{tikzpicture}[overlay,remember picture]
  320. \coordinate (A);
  321. \coordinate (B) at ($(A)-(6pt,-8pt)$);
  322. \end{tikzpicture}
  323. \begin{tikzpicture}[overlay,remember picture,yscale=-0.04,xscale=0.04,transform shape]
  324. \pic at (B) {orcidlogo};
  325. \end{tikzpicture}
  326. }{}}}
  327. %%%%%%%%%%%%%%%%%%%%%% Headers and footers
  328. %% Fancyhdr styling
  329. \RequirePackage{fancyhdr} % custom headers/footers
  330. \pagestyle{fancy} % Set all pagestyle to fancy
  331. % Clear everything
  332. \fancyhf{}
  333. % Headers
  334. \renewcommand{\headrulewidth}{0pt} % No header rule normally
  335. % Footers
  336. \renewcommand{\footrulewidth}{0pt} % No footer rule normally
  337. \fancyfoot[R]{% % footer right side
  338. \iftoggle{SI}{
  339. \footerfont\textit{Supplementary Information}\hspace{7pt}|% % we add SI as text
  340. }{
  341. \iftoggle{footpreprint}{
  342. \footerfont\textit{Preprint}\hspace{7pt}|% % we add preprint text
  343. }{}
  344. }
  345. \iftoggle{footdate}{
  346. \hspace{7pt}\textbf{\today}\hspace{7pt}|% % add date
  347. }{}
  348. \hspace{7pt}\textbf{\thepage}} % add page number
  349. \fancyfoot[L]{% % footer left side
  350. \footerfont\@ifundefined{@pubdoi}{}{%
  351. \href{https://dx.doi.org/\@pubdoi}{DOI: \@pubdoi}} % add DOI + hyperlink
  352. % \footerfont\@ifundefined{@leadauthor}{}{\@leadauthor}% % lead author name
  353. % \ifnum \value{authors} > 1\textit{ et al.}\fi% % and et.al.
  354. }
  355. % Modifying the plain style (applied automatically with title page)
  356. \fancypagestyle{plain}{%
  357. \fancyhf{} % clear everything
  358. \iftoggle{toprule}{% % if SI, we add a top rule
  359. \fancyhead[L]{% % Add article type and rule
  360. \colorbox{black}{\parbox{18em}{\centering\color{white}\subtitlefont{\arttype}}}}
  361. \renewcommand{\headrulewidth}{3pt}%
  362. }{}
  363. \fancyfoot[R]{ % footer right side
  364. \iftoggle{SI}{
  365. \footerfont\textit{Supplementary Information}\hspace{7pt}|% % we add SI as text
  366. }{
  367. \iftoggle{footpreprint}{
  368. \footerfont\textit{Preprint}\hspace{7pt}|% % we add preprint text
  369. }{}
  370. }
  371. \iftoggle{footdate}{
  372. \hspace{7pt}\textbf{\today}\hspace{7pt}|% % add date
  373. }{}
  374. \hspace{7pt}\textbf{\thepage\textendash\pageref{LastPage}}} % add page number
  375. \fancyfoot[L]{\footerfont\@ifundefined{@pubdoi}{}{% % footer left side
  376. \href{https://dx.doi.org/\@pubdoi}{DOI: \@pubdoi}}} % add DOI + hyperlink
  377. }
  378. %%%%%%%%%%%%%%%%%%%%%% Line numbers
  379. % Check switch for line numbers
  380. \iftoggle{linenumbers}{
  381. % use lineno in switch mode if doublecolumn
  382. \iftoggle{twocolumn}{
  383. \RequirePackage[switch]{lineno}
  384. }{
  385. \RequirePackage{lineno}
  386. }
  387. \renewcommand\linenumberfont{\normalfont\tiny\sffamily}
  388. \linenumbers
  389. }{}
  390. %%%%%%%%%%%%%%%%%%%%%% Typesetting
  391. %% Section/subsection/paragraph set-up
  392. \RequirePackage[explicit]{titlesec}
  393. \setcounter{secnumdepth}{5}
  394. \titleformat{\section}
  395. {\large\sffamily\bfseries}
  396. {\thesection.}
  397. {0.5em}
  398. {#1}
  399. []
  400. \titleformat{name=\section,numberless}
  401. {\large\sffamily\bfseries}
  402. {}
  403. {0em}
  404. {#1}
  405. []
  406. \titleformat{\subsection}[runin]
  407. {\sffamily\bfseries}
  408. {\thesubsection.}
  409. {0.5em}
  410. {#1. }
  411. []
  412. \titleformat{\subsubsection}[runin]
  413. {\sffamily\bfseries}
  414. {\thesubsubsection.}
  415. {0.5em}
  416. {#1. }
  417. []
  418. \titleformat{\paragraph}[runin]
  419. {\sffamily\small\bfseries}
  420. {}
  421. {0em}
  422. {#1}
  423. \titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{5pt}
  424. \titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{2pt}
  425. \titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{2pt}
  426. \titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{12pt}
  427. %% Abstract formatting
  428. \def\xabstract{abstract}
  429. \long\def\abstract#1\end#2{
  430. \def\two{#2}
  431. \ifx\two\xabstract
  432. \long\gdef\theabstract{\ignorespaces#1}
  433. \def\go{\end{abstract}}
  434. \else
  435. \typeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
  436. \gdef\theabstract{%
  437. \vskip12pt BADLY FORMED ABSTRACT: PLEASE DO NOT USE {\tt\string\begin...\string\end} COMMANDS WITHIN THE ABSTRACT\vskip12pt%
  438. }\let\go\relax
  439. \fi
  440. \go}
  441. % Define an environment with abstract content and styling
  442. \newcommand{\abscontent}{
  443. \noindent
  444. {%
  445. \vskip3pt%
  446. \iftoggle{tocfig}{
  447. \begin{minipage}{0.56\linewidth}
  448. \absfont \theabstract
  449. \end{minipage}
  450. \begin{minipage}{0.4\linewidth}
  451. \raggedleft
  452. \IfFileExists{figs/tocfig.png}{% no good way of checking for extension
  453. \includegraphics[width=0.9\linewidth]{figs/tocfig}}
  454. {\IfFileExists{figs/tocfig.bmp}{
  455. \includegraphics[width=0.9\linewidth]{figs/tocfig}}
  456. {\IfFileExists{figs/tocfig.pdf}{
  457. \includegraphics[width=0.9\linewidth]{figs/tocfig}}
  458. }{\includegraphics[width=0.9\linewidth]{example-image}}}
  459. \end{minipage}%
  460. }{
  461. \begin{minipage}{\linewidth}
  462. \absfont \theabstract
  463. \end{minipage}
  464. }
  465. }%
  466. \vskip10pt%
  467. \noindent
  468. \@ifundefined{@abstractadd}{}{%
  469. {%
  470. \parbox{\linewidth}{%
  471. \abstractaddfont \@abstractadd}%
  472. }%
  473. \vskip10pt%
  474. }%
  475. \noindent
  476. \@ifundefined{@keywords}{}{%
  477. {%
  478. \parbox{\linewidth}{%
  479. \keywordsfont %
  480. \textbf{Keywords:} \@keywords}%
  481. }%
  482. \vskip10pt%
  483. }%
  484. }
  485. %% Manual adjustment of vertical distance, useful for overall formatting
  486. \newlength\vert@adjust
  487. \newcommand\verticaladjustment[1]{\setlength{\vert@adjust}{#1}}
  488. %% Command to define an affiliation list in a footnote
  489. \def\authaffil{%
  490. \iftoggle{affiltop}{
  491. \@author\par%
  492. % \vskip2pt
  493. }{
  494. \AB@authlist\par
  495. \protected@xdef\@thanks{\@thanks\protect\footnotetext[\the\c@footnote]{\AB@affillist\newline}}%
  496. }
  497. }
  498. %% Command to define a contact email switch
  499. \def\contactswitch{%
  500. \contactfont\@ifundefined{@contact}{}{\textbf{\normalfont*}~E-Mail:~\@contact}\par%
  501. %
  502. \vskip3pt
  503. }
  504. %% Command to define an "equal contribution" switch
  505. \def\equalcontribswitch{
  506. \footerfont\@ifundefined{@equalcontrib}{}{\textsuperscript{\textbf{\dag}}~These authors contributed equally}\par%
  507. %
  508. \vskip3pt
  509. }
  510. %%%% Custom title page
  511. \renewcommand{\@maketitle}{%
  512. \iftoggle{shortintro}
  513. {% if short intro i.e. SI
  514. % patch author command to center section
  515. \patchcmd{\@author}{\raggedright}{\centering}{}{}
  516. %
  517. \topskip0pt
  518. \vspace*{\fill}%
  519. %
  520. {\centering\baselineskip=24pt\subtitlefont Supplementary Information for\par}%
  521. {\centering\baselineskip=24pt\titlefont \@title\par}%
  522. %
  523. \vskip10pt
  524. %
  525. % author names / addresses
  526. {\centering\authaffil{}}
  527. %
  528. \vskip8pt
  529. %
  530. % equal contribution
  531. {\centering\equalcontribswitch{}}
  532. % corresponding email
  533. {\centering\contactswitch{}}
  534. %
  535. \vspace*{\fill}%
  536. }
  537. {% else if complete paper
  538. %
  539. \vskip10pt%
  540. %
  541. {\raggedright\baselineskip=24pt\titlefont \@title\par}%
  542. %
  543. \vskip10pt
  544. %
  545. % author names / addresses
  546. \raggedright\authaffil{}
  547. %
  548. \vskip3pt
  549. %
  550. % equal contribution
  551. \raggedright\equalcontribswitch{}
  552. % corresponding email
  553. \raggedright\contactswitch{}
  554. % abstract / TOC section
  555. \raggedright{\abscontent{}}
  556. %
  557. \noindent\makebox[\linewidth]{\rule{\linewidth}{0.4pt}}%
  558. %
  559. \vskip15pt%
  560. }%
  561. \@ifundefined{vert@adjust}{}{\vskip\vert@adjust}%
  562. }%