wlpeerj.cls 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. %
  2. % An unofficial LaTeX class for PeerJ articles.
  3. %
  4. % Created by Overleaf (writeLaTeX).
  5. %
  6. % Based on the SelfArx document class.
  7. %
  8. \NeedsTeXFormat{LaTeX2e}
  9. \ProvidesClass{wlpeerj}[18/08/2016, v1.2]
  10. \RequirePackage[utf8]{inputenc}
  11. \RequirePackage[english]{babel}
  12. \RequirePackage{ifthen}
  13. \RequirePackage{calc}
  14. \AtEndOfClass{\RequirePackage{microtype}}
  15. \newif\if@peerjlineno
  16. \DeclareOption{lineno}{\@peerjlinenotrue}
  17. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  18. \ProcessOptions*
  19. \LoadClass{article}
  20. \RequirePackage{times} % Loads the Times-Roman Fonts
  21. \RequirePackage{mathptmx} % Loads the Times-Roman Math Fonts
  22. \RequirePackage{lineno} % For numbering the lines if lineno option is given
  23. \if@peerjlineno\linenumbers\fi
  24. \RequirePackage{ifpdf}
  25. \RequirePackage{amsmath,amsfonts,amssymb}
  26. \RequirePackage{graphicx,xcolor}
  27. \RequirePackage{booktabs}
  28. \RequirePackage{authblk}
  29. \RequirePackage[left=5cm,%
  30. right=2cm,%
  31. top=2.25cm,%
  32. bottom=2.25cm,%
  33. headheight=12pt,%
  34. letterpaper]{geometry}%
  35. \RequirePackage[labelfont={bf,sf},%
  36. labelsep=period,%
  37. justification=raggedright]{caption}
  38. % \RequirePackage{natbib}
  39. % \bibliographystyle{apalike}
  40. %
  41. % writeLaTeX logo
  42. %
  43. \newcommand\wllogo{%
  44. \renewcommand*\rmdefault{ugq}\normalfont\upshape{}write%
  45. \renewcommand*\rmdefault{cmr}\normalfont\upshape{\bf\LaTeX}}
  46. %
  47. % headers and footers
  48. %
  49. \RequirePackage{fancyhdr} % custom headers/footers
  50. \RequirePackage{lastpage} % Number of pages in the document
  51. \pagestyle{fancy} % Enables the custom headers/footers
  52. % Headers
  53. \lhead{}%
  54. \chead{}%
  55. \rhead{}%
  56. % Footers
  57. \lfoot{}%
  58. \cfoot{}%
  59. \rfoot{\small\sffamily\bfseries\thepage/\pageref{LastPage}}%
  60. \renewcommand{\headrulewidth}{0pt}% % No header rule
  61. \renewcommand{\footrulewidth}{0pt}% % No footer rule
  62. %
  63. % section/subsection/paragraph set-up
  64. %
  65. \RequirePackage[explicit]{titlesec}
  66. \titleformat{\section}
  67. {\color{color1}\large\sffamily\bfseries}
  68. {\thesection}
  69. {0.5em}
  70. {\MakeUppercase{#1}}
  71. []
  72. \titleformat{name=\section,numberless}
  73. {\color{color1}\large\sffamily\bfseries}
  74. {}
  75. {0em}
  76. {\MakeUppercase{#1}}
  77. []
  78. \titleformat{\subsection}
  79. {\sffamily\bfseries}
  80. {\thesubsection}
  81. {0.5em}
  82. {#1}
  83. []
  84. \titleformat{\subsubsection}
  85. {\sffamily\small\bfseries\itshape}
  86. {\thesubsubsection}
  87. {0.5em}
  88. {#1}
  89. []
  90. \titleformat{\paragraph}[runin]
  91. {\sffamily\small\bfseries}
  92. {}
  93. {0em}
  94. {#1}
  95. \titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{5pt}
  96. \titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{0pt}
  97. \titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{0pt}
  98. \titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{10pt}
  99. %
  100. % tableofcontents set-up
  101. %
  102. \usepackage{titletoc}
  103. \contentsmargin{0cm}
  104. \titlecontents{section}[\tocsep]
  105. {\addvspace{4pt}\small\bfseries\sffamily}
  106. {\contentslabel[\thecontentslabel]{\tocsep}}
  107. {}
  108. {\hfill\thecontentspage}
  109. []
  110. \titlecontents{subsection}[\tocsep]
  111. {\addvspace{2pt}\small\sffamily}
  112. {\contentslabel[\thecontentslabel]{\tocsep}}
  113. {}
  114. {\ \titlerule*[.5pc]{.}\ \thecontentspage}
  115. []
  116. \titlecontents*{subsubsection}[\tocsep]
  117. {\footnotesize\sffamily}
  118. {}
  119. {}
  120. {}
  121. [\ \textbullet\ ]
  122. \RequirePackage{enumitem}
  123. %\setlist{nolistsep} % Uncomment to remove spacing between items in lists (enumerate, itemize)
  124. % Remove brackets from numbering in List of References
  125. \renewcommand{\@biblabel}[1]{\bfseries\color{color1}\textsuperscript{[#1]}}
  126. %
  127. % article meta data
  128. %% LLT 18 Aug 2016: no more!
  129. % \newcommand{\keywords}[1]{\def\@keywords{#1}}
  130. %% LLT 18 Aug 2016: but need corresponding author
  131. \newcommand{\corrauthor}[3][]{%
  132. \def\thecorrauthor{%
  133. Corresponding author:\par #2$^{#1}$\par
  134. \medskip
  135. Email address: #3\par}
  136. }
  137. \def\xabstract{abstract}
  138. \long\def\abstract#1\end#2{\def\two{#2}\ifx\two\xabstract
  139. \long\gdef\theabstract{\ignorespaces#1}
  140. \def\go{\end{abstract}}\else
  141. \typeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J
  142. COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
  143. \gdef\theabstract{\vskip12pt BADLY FORMED ABSTRACT: PLEASE DO
  144. NOT USE {\tt\string\begin...\string\end} COMMANDS WITHIN
  145. THE ABSTRACT\vskip12pt}\let\go\relax\fi
  146. \go}
  147. %
  148. % custom title page
  149. %
  150. \renewcommand{\@maketitle}{%
  151. {%
  152. \thispagestyle{empty}%
  153. \vskip-36pt%
  154. {\raggedright\sffamily\bfseries\fontsize{20}{25}\selectfont \@title\par}%
  155. \vskip10pt
  156. {\raggedright\sffamily\fontsize{12}{16}\selectfont \@author\par}
  157. \vskip1em%
  158. % LLT 18 Aug 2016: needs corresponding author now
  159. \ifdefined\thecorrauthor
  160. {\raggedright\sffamily\thecorrauthor\par}
  161. \fi
  162. \vskip18pt
  163. {%
  164. \noindent
  165. {\parbox{\dimexpr\linewidth-2\fboxsep\relax}{\color{color1}\large\sffamily\textbf{ABSTRACT}}}
  166. }%
  167. \vskip10pt\nolinenumbers
  168. {%
  169. \noindent
  170. \colorbox{color2}{%
  171. \parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
  172. \sffamily\small\vskip1ex\if@peerjlineno\internallinenumbers\fi\theabstract
  173. }%
  174. }%
  175. %% LLT 18 Aug 2016: no more keywords
  176. % \vskip18pt%
  177. % \noindent
  178. % \parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
  179. % \if@peerjlineno\internallinenumbers\fi%
  180. % {\color{color1}\keywordname\hspace*{1em}} \@keywords%
  181. % }%
  182. }%
  183. \vskip25pt%
  184. }%
  185. }%
  186. %-----------------------------------------------
  187. \setlength{\columnsep}{0.55cm} % Distance between the two columns of text
  188. \setlength{\fboxrule}{0.75pt} % Width of the border around the abstract
  189. \definecolor{color1}{RGB}{0,0,0} % Color of section headings
  190. \definecolor{color2}{RGB}{250,232,207} % Color of the box behind the abstract
  191. \newcommand{\keywordname}{Keywords:} % Defines the keywords heading name
  192. \renewcommand\Authfont{\fontsize{12}{14}\usefont{OT1}{phv}{b}{n}}
  193. \renewcommand\Affilfont{\fontsize{10}{12}\usefont{OT1}{phv}{b}{n}}
  194. \newlength{\tocsep}
  195. \setlength\tocsep{1.5pc} % Sets the indentation of the sections in the table of contents
  196. \setcounter{tocdepth}{3} % Show only three levels in the table of contents section: sections, subsections and subsubsections
  197. \usepackage{lipsum} % Required to insert dummy text
  198. %-----------------------------------------------
  199. \let\oldbibliography\thebibliography
  200. \renewcommand{\thebibliography}[1]{%
  201. \addcontentsline{toc}{section}{\hspace*{-\tocsep}\refname}%
  202. \oldbibliography{#1}%
  203. \setlength\itemsep{0pt}%
  204. }