2

I was trying to create a new title page for uni project. For that I took an online template and changed the text.

The problem now is, that the title wraps and has different line height in some lines.

rendered pdf result

Produced by this latex MVP

\documentclass[11pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
    \begin{titlepage}

        \rule{1pt}{\textheight}
        \hspace{0.05\textwidth}
        \parbox[b]{0.75\textwidth}{
            \raggedright

            {\Huge\bfseries Entwicklung einer agentenbasierten Simulationsplattform mithilfe des JavaScript Ökosystems, am Beispiel einer Verkehrssimulation.}\\[2\baselineskip]
            {\large\textit{Subtitle}}\\[4\baselineskip]
            {\Large\textsc{Name}}

            \vspace{0.25\textheight}

            {\noindent Organization}\\[\baselineskip]
        }

    \end{titlepage}
\end{document}

Can I force a consistent line height?

And one additional question, can I reenable latex automatic word breaking, so it better utilizes the available space?

3
  • 1
    First question is fontsize - Inconsistent line spacing - TeX - LaTeX Stack Exchange, second question is... just remove the raggedright, you get what you ask for.
    – user202729
    Commented Apr 21, 2022 at 11:37
  • 1
    ragged2e offers \RaggedRight, which will still allow hyphenation. Much better than \raggedright, in my opinion.
    – Rmano
    Commented Apr 21, 2022 at 11:48
  • 1
    While the font size question has already been addressed by the linked question, the width allowed for this text is too narrow to look decent by just removing the raggedright. A "middle" approach is to use the package ragged2e and specify '\Raggecright`, which doesn't suppress hyphenation but does keep word spaces at their "natural" width. Commented Apr 21, 2022 at 11:48

1 Answer 1

2

Do not use \\[ ] as an inter-paragraph spacing, typeset proper paragraphs, ending them before changing the type size. And use ragged2e and a proper language set-up:

\documentclass[11pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{ragged2e}
\usepackage[ngerman]{babel}

\begin{document}
    \begin{titlepage}

        \rule{1pt}{\textheight}
        \hspace{0.05\textwidth}
        \parbox[b]{0.75\textwidth}{
            \RaggedRight

            {\Huge\bfseries Entwicklung einer agentenbasierten Simulationsplattform mithilfe des JavaScript Ökosystems, am Beispiel einer Verkehrssimulation.
            \par}
            \bigskip
            {\large\textit{Subtitle}\par}
            \bigskip
            {\Large\textsc{Name}\par}

            \vspace{0.25\textheight}

            {\noindent Organization}
            \bigskip
        }

    \end{titlepage}
\end{document}

Output from the snippet above

(well, JavaScript hyphenation should be fixed, of course)...

3
  • Thank you very much! This worked and I got an idea why it didn't before. Just two more questions, if it is ok with you: 1. Is there a way to hint or force a line break in a paragraph, so I could fix the JavaScript word wrap? 2. Can I configure the line height, to make the title a little bit more compact?
    – Feirell
    Commented Apr 21, 2022 at 12:11
  • The 1. is easy, add \hyphenation{Java-Script} (choose the splitting point) or \hyphenation{JavaScript} (no split) in the preamble. For 2: tex.stackexchange.com/a/48743/38080
    – Rmano
    Commented Apr 21, 2022 at 12:42
  • Perfect! Thank you :) I had found this tex.stackexchange.com/a/26191/268858 in the meantime, which is nice because it is not as verbose.
    – Feirell
    Commented Apr 21, 2022 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .