1

I have a problem Overfull \hbox (13.62198pt too wide) in paragraph at lines 49--50. I read similar questions and all the solutions introduced a manual intervention directly into the text - e.g. using a linebreak, a command from another package surrounding the problematic text, etc. I would like to define some settings in the beginning of the document, e.g. linebreak upon space if you cannot decide. I would like to avoid as much manual work as possible.

My problematic lines of the text are:

\begin{itemize}
\item The language of enquiry $\mathcal{L}$ is given by $\mathcal{C}_o=\{milk, curry, rice\}$,$\mathcal{R}_o=\{TastesHot, IsWhite, ContainsSpice, ContainsSugar\}$, $\mathcal{F}_o=\{\}$.
\item Let the observational language $\mathcal{L}_o$ be $\mathcal{C}_o=\{milk, curry, rice\}$, $\mathcal{R}_o=\{TastesHot, IsWhite\}$, $\mathcal{F}_o=\{\}$
\item Let the hypothesis language $\mathcal{L}_h$ be $\mathcal{C}_h=\{milk, curry, rice\}$, $\mathcal{R}_h=\{TastesHot, IsWhite, ContainsSpice\}$, $\mathcal{F}_h=\{\}$.
\item $\mathcal{L}_h$-sentences are $\forall x. TastesHot(x) \implies ContainsSpice(x)$, $\forall x. IsWhite(x) \lor TastesHot(x)$.
\end{itemize}

Settings in the beginning of the document are:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}
\usepackage{amsthm}
\usepackage{amsmath}

And the template code:

\pagestyle{empty}

\setlength{\parskip}{2ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}

\makeatletter  %to avoid error messages generated by "\@". Makes Latex treat "@" like a letter

\linespread{1.5}
\def\submitdate#1{\gdef\@submitdate{#1}}

\def\maketitle{
  \begin{titlepage}{
    %\linespread{1.5}
    \Large University of London \\
    %\linebreak
    Imperial College of Science, Technology and Medicine \\
    %\linebreak
    Department of Computing
    \rm
    \vskip 3in
    \Large \bf \@title \par
  }
  \vskip 0.3in
  \par
  {\Large \@author}
  \vskip 2.9in
  \par
  Submitted in partial fulfilment of the requirements for the MEng Degree
  \linebreak
  in Computing (Artificial Intelligence) of Imperial College London
  \linebreak
  \@submitdate
  \vfil
  \end{titlepage}
}

\def\titlepage{
  \newpage
  \centering
  \linespread{1}
  \normalsize
  \vbox to \vsize\bgroup\vbox to 9in\bgroup
}
\def\endtitlepage{
  \par
  \kern 0pt
  \egroup
  \vss
  \egroup
  \cleardoublepage
}

\def\abstract{
  \begin{center}{
    \large\bf Abstract}
  \end{center}
  \small
  %\def\baselinestretch{1.5}
  \linespread{1.5}
  \normalsize
}
\def\endabstract{
  \par
}

\newenvironment{acknowledgements}{
  \cleardoublepage
  \begin{center}{
    \large \bf Acknowledgements}
  \end{center}
  \small
  \linespread{1.5}
  \normalsize
}{\cleardoublepage}
\def\endacknowledgements{
  \par
}

\newenvironment{dedication}{
  \cleardoublepage
  \begin{center}{
    \large \bf Dedication}
  \end{center}
  \small
  \linespread{1.5}
  \normalsize
}{\cleardoublepage}
\def\enddedication{
  \par
}

\def\preface{
    \pagenumbering{roman}
    \pagestyle{plain}
    \doublespacing
}

\def\body{
    \cleardoublepage    
    \pagestyle{uheadings}
    \tableofcontents
    \pagestyle{plain}
    \cleardoublepage
    \pagestyle{uheadings}
    \listoftables
    \pagestyle{plain}
    \cleardoublepage
    \pagestyle{uheadings}
    \listoffigures
    \pagestyle{plain}
    \cleardoublepage
    \pagestyle{uheadings}
    \pagenumbering{arabic}
    \doublespacing
}

\makeatother  %to avoid error messages generated by "\@". Makes Latex treat "@" like a letter

Notice, these have the spaces, I do not understand why the Latex complains. I am new to Latex, perhaps a simple setting would solve my problem.

  • 1
    In math TeX does not normally break after a comma (and spaces are ignored) however it is hard to give specific advice without an example. Please always include a complete small document that shows the problem, the line breaking is affected by the page size, fonts, and packages loaded, none of which we can tell from a fragment. – David Carlisle Nov 19 '13 at 19:11
  • The excerpt I have provided is the thesis which uses a template. I am not certain what all the code of the template does, hence extracting the relevant sections would be probably harder than answering the question myself. Please, let me know if you need other information too apart from the one I am going to provide. – Dávid Natingga Nov 19 '13 at 19:21
  • the strings "milk, curry, rice" etc. are within the math, and the way they are coded, they are (1) in the wrong font, and (2) won't break. they really should be text (so they will be set in the proper font, among other reasons), in which case breaking would not be such a problem. – barbara beeton Nov 19 '13 at 19:34
  • @barbarabeeton I put the strings in the math mode as they are constants - semantically part of the mathematics language. In that context, "milk, curry, rice" are not words. Could I make linebreaks in math mode if there are spaces? – Dávid Natingga Nov 19 '13 at 19:38
  • But I still wonder: even if Latex put every math expression on a line, no expression would be longer than a line and these expressions have the spaces between each other. – Dávid Natingga Nov 19 '13 at 19:45
4

you've already separated the different elements, providing spaces between the distinct equations comprising each language and separately coding these equations as math (even though the space between the first two is, probably inadvertently, omitted). unfortunately, these spaces don't fall in a place that is optimal for tex to break the line.

the ultimate goal is for what is presented to be understood.

there are two parts to this recommendation.

first, the words "milk, curry, rice" are, as you say, constants, and as such should be in a text font, preferably not italic in this context, even though they're part of the math expression. as coded in your original, they are typeset as strings of variables multiplied together. these could be coded as \mathrm{<word>}, but that doesn't help with line breaking. it also wouldn't leave spaces after the commas, although in this situation, whether spaces are visible there or not wouldn't be misunderstood by a reader.

another way to approach these is to recognize them as text, and input them as, for example,

$\mathcal{C}_o=\{\text{milk, curry, rice}\}$

but this doesn't help with line breaking either, since in this context, the only "allowable" break is after the equals sign.

so, second part of suggestion, take advantage of the fact that a reader isn't likely to misunderstand what is meant if a line is broken within that string of constants, and (temporarily) terminate the math after the opening brace, and reinstate it for the ending brace:

$\mathcal{C}_o=\{$milk, curry, rice$\}$

to illustrate, using a forced line break for the "all math" instance, compare these two lines:

enter image description here

here's the input that produced the image:

\begin{itemize}
\item The language of enquiry $\mathcal{L}$ is given by
$\mathcal{C}_o=\{milk, curry, rice\}$,\\
$\mathcal{R}_o=\{TastesHot, IsWhite, ContainsSpice, ContainsSugar\}$,
$\mathcal{F}_o=\{\}$.
\item The language of enquiry $\mathcal{L}$ is given by
$\mathcal{C}_o=\{$milk, curry, rice$\}$,
$\mathcal{R}_o=\{$TastesHot, IsWhite, ContainsSpice, ContainsSugar$\}$,
$\mathcal{F}_o=\{\}$.
\end{itemize}

(by the way, that's hardly a minimal example.)

  • Thank you. In the end I decided to implement your first solution of the forced manual linebreak in mathmode. Although I am not a Latex expert, the papers I have read so far, render constants in italic as semantically we think of them the same way as of variables and functions. I have never seen a variable or a function written in a text font. You also mentioned that Tex does not break the line because it does not consider to do so at the space to be optimal. Is there any way I could regulate this "optimality"? I do not mind a line with little text, the next one with a math equation. – Dávid Natingga Nov 20 '13 at 7:47
  • 1
    @dt1510 never use the math italic for multi-letter identifiers, it has wide sidebearings specifically to make it clear that adjacent letters do not form a word but rather are implied multiplication. If you want an italic identifier use \mathit{milk} – David Carlisle Nov 20 '13 at 8:32
  • @dt1510 -- regarding "optimality" for line breaking, the mechanism is described in the texbook, and is rather too complicated to summarize in a comment. however, observe that very few places in in-line math are automatically allowed as breakable; an \mbox will prevent breaking; spaces and recognized hyphenation points in running text are the only really "reliable" break points, and only when one falls in a position close enough to the end of a line that other text spaces will not be unduly stretched or compressed to justify the line. – barbara beeton Nov 23 '13 at 15:07

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.