Skip to content
Snippets Groups Projects
Commit 2e3297c9 authored by Jan Wille's avatar Jan Wille
Browse files

allow for `\and` to be used

IN typical LaTeX, the `\and` command is used inside `\author` to separate multiple authors, this allows for that.
parent ebf2dc32
Branches
Tags
No related merge requests found
...@@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file. ...@@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file.
Here is a regex to fix existing code: `(?<=\\ifsingleauthor)(\{.*?\})\\else(\{.*?\})\\fi(\\space)?` Here is a regex to fix existing code: `(?<=\\ifsingleauthor)(\{.*?\})\\else(\{.*?\})\\fi(\\space)?`
which you can replace with `$1$2`. which you can replace with `$1$2`.
### Added
- Using the `\and` command inside `\author` or `\matrikelnr` now works as expected (#21)
## [3.2] ## [3.2]
### Fixed ### Fixed
......
No preview for this file type
...@@ -312,13 +312,15 @@ ...@@ -312,13 +312,15 @@
} }
} }
} }
\let\@author\@empty
\renewcommand{\title}[2][]{ \renewcommand{\title}[2][]{
\gdef\@title{#2} \gdef\@title{#2}
\gdef\@shorttitle{#1} \gdef\@shorttitle{#1}
} }
\def\@shorttitle{\@empty} \def\@shorttitle{\@empty}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} \def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
\let\@author\@empty
\newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
\def\@matrikelnr{\@empty} \def\@matrikelnr{\@empty}
\newcommand{\professor}[1]{\gdef\@professor{#1}} \newcommand{\professor}[1]{\gdef\@professor{#1}}
\def\@professor{\@empty} \def\@professor{\@empty}
......
...@@ -1160,12 +1160,6 @@ http://www.latex-project.org/lppl.txt ...@@ -1160,12 +1160,6 @@ http://www.latex-project.org/lppl.txt
% how the user can define the differnt datafields. % how the user can define the differnt datafields.
% \smallskip % \smallskip
% %
% First the |\@author| macro is set to |\@empty|, this makes it easyer to handle it
% later.
% \begin{macrocode}
\let\@author\@empty
% \end{macrocode}
%
% \begin{macro}{\title} % \begin{macro}{\title}
% We redefine the |\title| command to take a optional argument. This is stored in % We redefine the |\title| command to take a optional argument. This is stored in
% the additional |\@shorttitle| macro. % the additional |\@shorttitle| macro.
...@@ -1185,11 +1179,33 @@ http://www.latex-project.org/lppl.txt ...@@ -1185,11 +1179,33 @@ http://www.latex-project.org/lppl.txt
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{\gdef@with@and@as@comma}
% First we define a helpermacro that will fill a given macro while treating the
% |\and| command as a comma. This is needed for |\author| and |\matrikelnr| where
% we later treat them as comma-seperated lists when the titlepage gets constructed.
% \begin{macrocode}
\def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\author}
% We redefine the |\author| command so that it sets |\@author|, but allowing for both
% comma and |\and| to be used as a seperator.
% \begin{macrocode}
\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
% \end{macrocode}
% The |\@author| macro is also set to |\@empty|, this makes it easier to handle it
% later.
% \begin{macrocode}
\let\@author\@empty
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\matrikelnr,\@matrikelnr} % \begin{macro}{\matrikelnr,\@matrikelnr}
% These macros set and store the matrikel-number (or set of numbers), which will % These macros set and store the matrikel-number (or set of numbers), which will
% be printed on the titlepage. % be printed on the titlepage.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} \newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
\def\@matrikelnr{\@empty} \def\@matrikelnr{\@empty}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
......
No preview for this file type
...@@ -325,13 +325,15 @@ ...@@ -325,13 +325,15 @@
} }
} }
} }
\let\@author\@empty
\renewcommand{\title}[2][]{ \renewcommand{\title}[2][]{
\gdef\@title{#2} \gdef\@title{#2}
\gdef\@shorttitle{#1} \gdef\@shorttitle{#1}
} }
\def\@shorttitle{\@empty} \def\@shorttitle{\@empty}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} \def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
\let\@author\@empty
\newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
\def\@matrikelnr{\@empty} \def\@matrikelnr{\@empty}
\newcommand{\professor}[1]{\gdef\@professor{#1}} \newcommand{\professor}[1]{\gdef\@professor{#1}}
\def\@professor{\@empty} \def\@professor{\@empty}
......
No preview for this file type
...@@ -6,9 +6,13 @@ ...@@ -6,9 +6,13 @@
%% documents personal data: %% documents personal data:
\author{ \author{
Max Mustermann, Max Mustermann \and
Mira Musterfrau Mira Musterfrau
} }
\matrikelnr{
12345678,
12345
}
\titlehead{titlehead} \titlehead{titlehead}
\subject{Subject} \subject{Subject}
\title{long and elaborate title that just goes on and on without stopping} \title{long and elaborate title that just goes on and on without stopping}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment