1

I'm working on a custom homework template, and for some reason, word break malfunctions on long words in the first line. I've included a MWE. Does anyone have any idea of what is going on?

example


\documentclass[12pt]{article} 
\usepackage{lipsum}

\usepackage{enumerate}
\usepackage{enumitem}

\usepackage[scale=0.95]{libertine}
\usepackage[libertine]{newtxmath}

\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{graphicx}

%%%%%%%%%%%%%%% FORMAT
\newcommand{\alphabet}{%
  abcdefghijklmnopqrstuvwxyz%
}
\newlength{\textW}
\setlength{\textW}{\widthof{\alphabet}* \real{2.5}}%Page width
\usepackage[letterpaper,textwidth=\textW,top=1in,bottom=1in]{geometry}
%%%%%%%%%%%%%%% END FORMAT

\newlist{problems}{enumerate}{2}
\setlist[problems, 1]{
    label=Problem~\arabic*.\protect\thisproblem,
    before=\leavevmode\itshape, 
    font =\bf,
    wide = 0pt, 
}%
\setlist[problems, 2]{
    label=\alph*., 
    wide=0pt, 
    before=\leavevmode, 
    font =\bf,
    topsep=0pt,
}%
\newenvironment{parts}{\problems}{\endproblems}
\let\part\item
\let\thisproblem\item

\newcommand{\problem}[1][]{%
  \if\relax\detokenize{#1}\relax
    \def\thisproblem{}%
  \else
    \def\thisproblem{~(#1)}%
  \fi
  \item}
%%%%%%%%%%%%%%% END ENVIRONMENTS


\begin{document} 
\begin{problems}
    \problem[My Math Book IX.4.3(a)] \lipsum[1-1]
\end{problems}
\end{document} 
5

Loading Latin hyphenation patterns solves your issue (but I guess the final document will not be in Latin -- funny enough there is also no overfull box if one uses British). So to answer your question: The used hyphenation patterns don't return feasible hyphenation points in the word "consectetuer" resulting in no hyphenation in the first line.

\documentclass[12pt]{article} 
\usepackage[latin]{babel}
\usepackage{lipsum}

\usepackage{enumerate}
\usepackage{enumitem}

\usepackage[scale=0.95]{libertine}
\usepackage[libertine]{newtxmath}

\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{graphicx}

%%%%%%%%%%%%%%% FORMAT
\newcommand{\alphabet}{%
  abcdefghijklmnopqrstuvwxyz%
}
\newlength{\textW}
\setlength{\textW}{\widthof{\alphabet}* \real{2.5}}%Page width
\usepackage[letterpaper,textwidth=\textW,top=1in,bottom=1in]{geometry}
%%%%%%%%%%%%%%% END FORMAT

\newlist{problems}{enumerate}{2}
\setlist[problems, 1]{
    label=Problem~\arabic*.\protect\thisproblem,
    before=\leavevmode\itshape, 
    font =\bf,
    wide = 0pt, 
}%
\setlist[problems, 2]{
    label=\alph*., 
    wide=0pt, 
    before=\leavevmode, 
    font =\bf,
    topsep=0pt,
}%
\newenvironment{parts}{\problems}{\endproblems}
\let\part\item
\let\thisproblem\item

\newcommand{\problem}[1][]{%
  \if\relax\detokenize{#1}\relax
    \def\thisproblem{}%
  \else
    \def\thisproblem{~(#1)}%
  \fi
  \item}
%%%%%%%%%%%%%%% END ENVIRONMENTS


\begin{document} 
\begin{problems}
    \problem[My Math Book IX.4.3(a)] \lipsum[1-1]
\end{problems}
\end{document} 

enter image description here

The available hyphenation points with \usepackage[latin]{babel} are con-sec-te-tuer while without that line you'd get con-sectetuer.

| improve this answer | |
  • Worked, but my proof now reads "Demonstratio." instead of "Proof". Idea of how to fix? – Möbius Dickus Sep 25 '18 at 13:56
  • 2
    @MöbiusDickus do you intend to write your document in Latin? Then do nothing. Do you intend to write your document in another language and not use the exact same wording in your environment? Then load the appropriate language for babel, e.g. if you're writing in British English, you'll use \usepackage[british]{babel}, if you're writing in German \usepackage[ngerman]{babel} and so on. The above only shows you that the problem is not your environment but its contents and the fact that it doesn't use the correct hyphenation patterns for that specific content. – Skillmon Sep 25 '18 at 14:02
  • Oh, I see. I didn’t know about the babel package, and I wasn’t aware that the solution had anything to do with the fact that my text was in Latin. Thanks so much. – Möbius Dickus Sep 25 '18 at 15:35
  • @MöbiusDickus if you intend to use LuaLaTeX or XeLaTeX you might also be interested in the polyglossia package as an alternative to babel. – Skillmon Sep 25 '18 at 22:53

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.