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

added the option to defien a shorttitle which is used in the header

parent 930505bb
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
## [Current]
### Changed
- `\title` now accepts an optional argument. It will be used as a short version of the title and will be put into the header.
### Fixed
- `\ihead` and `\ohead` now have a max width and will break into multiple lines (#7)
......
......@@ -143,6 +143,12 @@
%<*article|report>
%% title matters ----------------------------------------------------------------------------------
%
% redefine title to accept a short tile (like chapter, etc..)
\newcommand*{\@shorttitle}{\@empty}
\renewcommand{\title}[2][]{
\gdef\@title{#2}
\gdef\@shorttitle{#1}
}
\newcommand*{\@matrikelnr}{}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
\newcommand*{\@professor}{}
......@@ -169,10 +175,18 @@
%<*article|report>
%% header and footer
\newpagestyle{HsHheadings}{
{\parbox{\sls@headwidth}{\LaTeXraggedright\@title}}
{\parbox{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedright\@title}%
\parbox[b]{\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
}
{\parbox[b]{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
\hfill
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedleft\headmark}%
}
......
......@@ -164,7 +164,8 @@ You can use the following macros to define the different information presented o
comma-seperated list, if more than one author is present.
- `\titlehead` is for a small line left of the logo. This is usually the department or division. May be empty
- `\subject` is for a broad description of what your file is. "Laborbericht" for example. Can be empty.
- `\title` is quite obvious. The only one that must be present.
- `\title` is quite obvious. The only one that must be present. I additionally accept an optional parameter which will be treated as a short form of
the title and used in the header (this makes sense if your title is very long and fills your header too much)
- `\subtitle` is a smaller second line under the title. Can be empty
- `\date` is the date of your project. You can use a custom one, but if you don't set it, the current date at compile time will be used.
- `\professor` a new macro do define your professors name, if needed.
......
......@@ -101,6 +101,11 @@
\PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz}
%% title matters ----------------------------------------------------------------------------------
\newcommand*{\@shorttitle}{\@empty}
\renewcommand{\title}[2][]{
\gdef\@title{#2}
\gdef\@shorttitle{#1}
}
\newcommand*{\@matrikelnr}{}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
\newcommand*{\@professor}{}
......@@ -120,10 +125,18 @@
%% header and footer
\newpagestyle{HsHheadings}{
{\parbox{\sls@headwidth}{\LaTeXraggedright\@title}}
{\parbox{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedright\@title}%
\parbox[b]{\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
}
{\parbox[b]{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
\hfill
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedleft\headmark}%
}
......
......@@ -101,6 +101,11 @@
\PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz}
%% title matters ----------------------------------------------------------------------------------
\newcommand*{\@shorttitle}{\@empty}
\renewcommand{\title}[2][]{
\gdef\@title{#2}
\gdef\@shorttitle{#1}
}
\newcommand*{\@matrikelnr}{}
\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
\newcommand*{\@professor}{}
......@@ -120,10 +125,18 @@
%% header and footer
\newpagestyle{HsHheadings}{
{\parbox{\sls@headwidth}{\LaTeXraggedright\@title}}
{\parbox{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedright\@title}%
\parbox[b]{\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
}
{\parbox[b]{\sls@headwidth}{\LaTeXraggedleft\leftmark}}
{
\parbox[b]{.45\sls@headwidth}{
\LaTeXraggedright
\ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
}%
\hfill
\parbox[b]{.45\sls@headwidth}{\LaTeXraggedleft\headmark}%
}
......
No preview for this file type
......@@ -18,7 +18,7 @@
}
\titlehead{titlehead}
\subject{Subject}
\title{long and elaborate title that just goes on and on witout stopping}
\title[short title]{long and elaborate title that just goes on and on witout stopping}
\subtitle{Subtitle}
\date{\today}
\professor{Professor}
......@@ -49,6 +49,8 @@
\caption{test}
\end{figure}
title test: \ifx\@shorttitle\@empty\@title\else\@shorttitle\fi
noch ein test \normalsubscripts$R_t$ \upsubscripts$R_t$
mit einheit: $R=200\,\mohm+ \SI{0.34567453}{\volt\per\metre}$
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment