0

I am trying to create a custom title for my document, but the space between my horizontal lines, or the spacing in general doesn't work properly. Here is a minimal-working-example, which - I hope - yields more clarity:

\documentclass[a4paper,12pt,DIV=15, ngerman]{scrartcl}  % parskip=half or parskip=full
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage{lipsum}  
\usepackage{lmodern}


\newcommand{\mytitle}{
        \textsf{
            \begin{center}
                \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thick horizontal rule
                \rule{\textwidth}{0.4pt} % Thin horizontal rule
                \vspace{0.75\baselineskip} % Whitespace above the title
                \Large \textbf{Wonderfull Title} \\ %\vspace{0.3cm}
                \large\textbf{Here stands a great Subtitle}
                \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thin horizontal rule
                \rule{\textwidth}{1.6pt} % Thick horizontal rule
                \vspace{2\baselineskip} % Whitespace after the title block
                Last compiled on \textbf{Date} \\
                von \textbf{Author}\\
            \end{center}
        }
}

\begin{document}
    \mytitle
    
\lipsum[1]
\end{document}

The result is: enter image description here

The problems are:

  • The spacing between the bottom lines seems like intended, but between the top lines, there is too much space, despite it beeing exactly the same code
  • Between the Subtitle and the two bottom lines, there is too much space
  • Between the Date and the author is way too much space

My Questions regarding this topic are:

  1. Why is the spacing as it is? What is Latexs intention? I would like to understand the inner workings of tex better.
  2. How can my concrete problems with spacing be solved?
  3. What are the best practises for creating a good looking title?

(Of course I am happy to get any input, f.e. for better practises in latex in general - it doesn't have to directly answer the questions)

Thank you for your answers in advance!

P.S.: This is my first post on this forum so please criticize me constructively! I am really unsure, how to express myself in the most clear way.

1
  • Welcome to TeX.SE!
    – Mensch
    Nov 28, 2021 at 20:55

2 Answers 2

1

The main problem was the \Large and \large affecting the baseline skips. Use { and } to limit their scope.

After that it is easy to control the vertical spaces between the elements.

Regarding the two parallel lines, see the useful example in Drawing close together horizontal lines

For inspiration look the nice titles in nice title pages

As an example on how to design a cover or a title page according to strict specifications see Tschichold

a

\documentclass[a4paper,12pt,DIV=15, ngerman]{scrartcl}  % parskip=half or parskip=full
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage{lipsum}  
\usepackage{lmodern}


\newcommand{\mytitle}{%
        \textsf{%
        \centering
        \hrule height 1.6pt depth 0pt width \textwidth
        \vspace{2pt}
        \hrule height 0.4pt depth 0pt width \textwidth
        \bigskip
        {\bfseries \Large Wonderfull Title} \\ \vspace{0.3cm}
        {\bfseries \large Here stands a great Subtitle} \\\vspace{10pt}
        \hrule height 0.4pt depth 0pt width \textwidth
        \vspace{2pt}
        \hrule height 1.6pt depth 0pt width \textwidth
        \vspace{\baselineskip} % Whitespace after the title block
        Last compiled on \textbf{Date} \\ \vspace{0.3cm}
        von \textbf{Author}\\
        \vspace*{3\baselineskip}    
    }
}

\begin{document}
    \mytitle
    
    \lipsum[1]
\end{document}

Finally, to protect the template and ensure consistency when used repeatedly, define a command with four mandatory parameters:

\newcommand{\mytitle}[4]{% four mandatory parameters
\textsf{%
    \centering
    \hrule height 1.6pt depth 0pt width \textwidth
    \vspace{2pt}
    \hrule height 0.4pt depth 0pt width \textwidth
    \bigskip
    {\bfseries \Large #1} \\ \vspace{0.3cm}
    {\bfseries \large #2} \\\vspace{10pt}
    \hrule height 0.4pt depth 0pt width \textwidth
    \vspace{2pt}
    \hrule height 1.6pt depth 0pt width \textwidth
    \vspace{\baselineskip} % Whitespace after the title block
    Last compiled on \textbf{#3} \\ \vspace{0.3cm}
    von \textbf{#4}\\
    \vspace*{3\baselineskip}    
        }
    }

And use as \mytitle{Wonderfull Title}{Here stands a great Subtitle}{Date}{Author}

1
  • Thank you very much! This was really helpful!
    – Sinthoras
    Nov 29, 2021 at 16:48
1

If you have

\rule{\textwidth}{0.4pt} % Thin horizontal rule
\vspace{0.75\baselineskip} % Whitespace above the title
\Large \textbf{Wonderfull Title} 

Then a rule is added in horizontal mode, then still in horizontal mode the space .75 of the current baselineskip is stored away to be added after the next line. Then \Large is executed which changes the font and current baselineskip (but not the value just stored) then the text Wonerfull Title is set. Then there is a newline so the saved vspace is added after that text.

similarly the large space after the date is the \vspace{2\baselineskip} which was added in horizontal mode in that line so appears at the linebreak after the date.

You should almost always use a blank line (or \par) before \vspace so that it is added at the point it appears, also add a \par or blank line at each size change so that the current paragraph is set with a suitable baselineskip.

2
  • Thank you! Now the spacing finally makes sense to me! Before, it was somewhat strange and frankly annoying. The Insertions of \par don't really work since - for some reason I don't really understand - the document gives me an error, when I do that. But thats not that important since the approach of Simon Dispas answer works perfectly.
    – Sinthoras
    Nov 29, 2021 at 16:55
  • @Sinthoras yes (just) after \centering, \\ uses \par internally so a \vspace after \\ appears at that point (without the \centering it would again appear after the following line) Nov 29, 2021 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.