rtthesis-papers.sty 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. \RequirePackage{setspace}
  2. \newcommand{\paperseptitlefont}{}
  3. \newcommand{\papersepauthorfont}{}
  4. \newcommand{\papertitlefont}{\LARGE\bfseries}
  5. \newcommand{\paperauthorfont}{}
  6. \newcommand{\paperaffilfont}{}
  7. \newcommand{\paperemailfont}{\texttt}
  8. % Commands for changing some of the commands above.
  9. \newcommand{\email}[1]{\renewcommand{\@email}{#1}}
  10. \newcommand{\rtpapers@thanks}[1]{\footnote{#1}}
  11. %%% Captions and strings that will be re-defined when the language is changed.
  12. %%% The first one is just a fixed string.
  13. \newcommand{\paperaffiliation}{Department so~and~so}
  14. %%% The following three are meant to be used inside paperinfo items.
  15. \newcommand{\paperedited}[1]{\textit{Edited version of the paper:} \citet{#1}}% Full caption is set upon selection of language.
  16. \newcommand{\paperprelver}[1]{\textit{Preliminary version:} LiTH-ISY-R-#1.}% Full caption is set upon selection of language.
  17. \newcommand{\papertechrep}[1]{Published as LiTH-ISY-R-#1.}% Full caption is set upon selection of language.
  18. \newcommand*{\rtpapers@globalchapter}{\ClassError{rtthesis}{%
  19. The rtpapers@globalchapter command should\MessageBreak
  20. be have been redefined at the beginning\MessageBreak
  21. of the papers environment%
  22. }{%
  23. The rtpapers@globalchapter command should\MessageBreak
  24. be have been redefined at the beginning\MessageBreak
  25. of the papers environment%
  26. }}
  27. \newcommand*{\rtpapers@chapter}[2][]{%
  28. \def\rtpapers@shorttitle{#1}%
  29. \title{#2}%
  30. \stepcounter{rtpapers@chapter}
  31. \ifx\rtpapers@shorttitle\@empty
  32. \rtpapers@globalchapter{#2}%
  33. \else
  34. \rtpapers@globalchapter[#1]{#2}%
  35. \fi
  36. \thispagestyle{empty}%
  37. \renewcommand*{\thesection}{\arabic{section}}%
  38. }
  39. \newenvironment{paperinfo}{%
  40. \begin{list}{}{\setlength{\itemsep}{5mm}%
  41. \setlength{\parskip}{25mm}%
  42. \setlength{\rightmargin}{0mm}%
  43. \setlength{\leftmargin}{\rightmargin}}
  44. \item
  45. \textit{Authors:} {
  46. \renewcommand*\affilmark[1]{}
  47. \papersepauthorfont{\@author}
  48. }}{%
  49. \end{list}}
  50. \newcommand*{\rtpapers@globalsection}{\ClassError{rtthesis}{%
  51. The rtpapers@globalsection command should\MessageBreak
  52. be have been redefined at the beginning\MessageBreak
  53. of the document%
  54. }{%
  55. The rtpapers@globalsection command should\MessageBreak
  56. be have been redefined at the beginning\MessageBreak
  57. of the document%
  58. }}
  59. \newcounter{rtpapers@section}
  60. \newcommand*{\rtpapers@section@NoStar}[2][]{%
  61. \def\rtpapers@shorttitle{#1}%
  62. \stepcounter{rtpapers@section}
  63. \ifx\rtpapers@shorttitle\@empty
  64. \rtpapers@globalsection{#2}%
  65. \else
  66. \rtpapers@globalsection[#1]{#2}%
  67. \fi
  68. }
  69. \newcommand*{\rtpapers@section@Star}[1]{%
  70. \rtpapers@globalsection*{#1}%
  71. }
  72. \newcommand{\rtpapers@section}{\@ifstar\rtpapers@section@Star\rtpapers@section@NoStar}
  73. \newcommand*{\rtpapers@appendix}{%
  74. \setcounter{rtpapers@section}{0}% Do not mess with the "real" section counter here! It will mess up the bookmarks.
  75. \renewcommand*{\thesection}{\Alph{rtpapers@section}}%
  76. \section*{\appendixname}%
  77. % \addtocontents{toc}{\protect\vspace{1mm}}%
  78. }
  79. %%% This is part of a hack, see \putbib below. The following command will act like \section when called with a star, except that it will add a contents line.
  80. \newcommand{\TOCsection@NoStar}[2][]{\ClassError{rtthesis}{TOCsection@NoStar was not supposed to be called}{TOCsection@NoStar was not supposed to be called}}
  81. \newcommand{\TOCsection@Star}[1]{\ifrt@UseHyperref\phantomsection\fi\rtpapers@bibsection*{#1}\addcontentsline{toc}{section}{#1}}
  82. \newcommand{\TOCsection}{\@ifstar\TOCsection@Star\TOCsection@NoStar}
  83. \newif\ifrt@papersBibLevelSection% When this is false, bibliographies goes on the chapter level.
  84. \rt@papersBibLevelSectionfalse
  85. \newcommand{\rtpapers@putbib}[1][]{
  86. \def\bibargs{#1}
  87. \rtthesis@assertnonobackref%
  88. \begingroup
  89. \let\stdthebibliography\thebibliography
  90. \ifrt@papersBibLevelSection
  91. % This is a little hack to make the bibliographies of papers appear among the bookmarks.
  92. \let\rtpapers@bibsection\section
  93. \def\thebibliography{\let\section\TOCsection\global\def\thesection{}\stdthebibliography}
  94. \else
  95. % The bibliographies on chapter level are handled nicely by tocbibind, loaded by rtthesis.
  96. \fi
  97. \markright{\bibname}
  98. \ifx\bibargs\@empty
  99. \rtpapers@globalputbib
  100. \else
  101. \rtpapers@globalputbib[#1]
  102. \fi
  103. \endgroup
  104. }
  105. \AtBeginDocument{%
  106. \@ifpackageloaded{bibentry}{%
  107. \let\rtpapers@globalputbib\putbib
  108. \let\putbib\rtpapers@putbib
  109. }{}}
  110. \newcounter{rtpapers@chapter}
  111. \newenvironment{papers}
  112. {% Setting up article look
  113. \setcounter{rtpapers@chapter}{0}% Warning! Do not try to reset the chapter counter here. It will mess up the bookmars!
  114. \chapternumberfont{\Huge\sffamily}
  115. \chapternamefont{\Huge\sffamily}
  116. \renewcommand*\chaptername{Paper}
  117. \renewcommand*\thechapter{\Alph{rtpapers@chapter}}
  118. \renewcommand*\thesection{\arabic{section}}
  119. \renewcommand*\theequation{\arabic{equation}}
  120. \renewcommand*\thelemma{\arabic{lemma}}
  121. \renewcommand*\thecorollary{\arabic{corollary}}
  122. \renewcommand*\theproposition{\arabic{proposition}}
  123. \renewcommand*\thetable{\arabic{table}}
  124. \renewcommand*\thefigure{\arabic{figure}}
  125. \renewcommand*\bibsection{\section*{\bibname}}
  126. \renewcommand*\thetheorem{\arabic{theorem}}
  127. \renewcommand*\thert@definition{\arabic{rt@definition}}
  128. \ifcsname c@algorithm\endcsname
  129. \numberwithin{algorithm}{chapter}
  130. \providecommand*\thealgorithm{\arabic{algorithm}}
  131. \renewcommand*\thealgorithm{\arabic{algorithm}}
  132. \fi
  133. \ifrt@shareTheoremCounter
  134. % Assumptions use the theorem counter. Nothing to do.
  135. \else
  136. \numberwithin{rt@assumption}{chapter}
  137. \fi
  138. % \renewcommand*\theassumption{\arabic{assumption}}
  139. \renewcommand*\thert@remark{\arabic{rt@remark}}
  140. \renewcommand*{\theExample}{\arabic{Example}}%
  141. \setchapapp{\chaptername}
  142. % Article-type abstract
  143. \renewenvironment{abstract}
  144. {\begin{center}\large\textbf{Abstract}\end{center}
  145. \begin{quote}}{\end{quote}}
  146. % Keywords
  147. \newenvironment{keyword}{\textbf{\textsf{Keywords:} }}{}
  148. \let\rtpapers@globalchapter\chapter
  149. \let\chapter\rtpapers@chapter
  150. \let\rtpapers@globalsection\section
  151. \let\section\rtpapers@section
  152. \let\appendix\rtpapers@appendix
  153. \let\appendices\appendix
  154. \rt@papersBibLevelSectiontrue
  155. }{%
  156. \rt@papersBibLevelSectionfalse
  157. \setchapapp{\relax}
  158. }
  159. \newcommand*\makepapertitle{%
  160. % Define acknowledgements as footnote and make the desired
  161. % settings for it.
  162. \bgroup% Avoid leaking footnote-changes to the global namespace
  163. \def\thefootnote{} % Standard cssconf.cls
  164. \def\footnotemark{} % Standard cssconf.cls
  165. \let\thanks=\rtpapers@thanks
  166. \renewcommand{\footnoterule}{}
  167. \interfootnotelinepenalty=10000
  168. \interdisplaylinepenalty=2500
  169. \clearemptydoublepage
  170. \thispagestyle{plain}%
  171. \addvspace{10mm}%
  172. \begin{center}\par
  173. {\papertitlefont\@title\par}
  174. \addvspace{8mm}
  175. {\paperauthorfont{\@author}\par}
  176. \addvspace{4mm}
  177. {
  178. \begin{tabular}[t]{c}
  179. \paperaffilfont
  180. \@affils
  181. \end{tabular}
  182. }
  183. % {{\paperaffiliation}\\
  184. % \paperemailfont{\@email}\par}
  185. \end{center}
  186. \addvspace{6mm}%
  187. \egroup
  188. \gdef\@affils{}
  189. }
  190. \def\affiliations#1{%
  191. \def\and{% % \begin{tabular}
  192. \bigskip%
  193. \end{tabular}%
  194. \hskip 1em \@plus.17fil%
  195. \begin{tabular}[t]{c}%
  196. \paperaffilfont}% % \end{tabular}
  197. \gdef\@affils{#1}}
  198. \newcommand*\affilemail[1]{\paperemailfont{#1}}
  199. \newcommand*\affilmark[1]{\hbox{\expandafter\@textsuperscript{#1}}}
  200. \newcommand*\affil[1]{\hbox{\makebox[0pt][r]{\@textsuperscript{#1}}}\!}