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:
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.)
Both \\
and \linebreak
take an optional argument, and so you need to end the expansion with \relax
, so that the bracket is taken as text, and not as an optional argument. The optional argument for \\
, if used, is expected to be a length dimension indicating the additional vertical space to provide. And so [foo]
does not qualify, thus generating an error.
For \linebreak
, the optional argument is a number between 0 and 4. According to Lamport, "a larger value of [num]
more strongly encourages or discourages the line break." The default is equivalent to 4. Thus, [foo]
likewise breaks the expansion of \linebreak
.
\newline
, on the other hand, does not take an optional argument, and so [foo]
following it works fine.
\documentclass{report}
\begin{document}
test\\\relax [foo]
test\linebreak\relax [foo]
test\newline [foo]
\end{document}
For example, test\\[12pt][foo]
will add a larger gap after test
and before [foo]
:
\documentclass{report}
\begin{document}
test\\[12pt][foo]
test\linebreak\relax [foo]
test\newline [foo]
\end{document}
Best Answer
I suggest to use a
tabular
environment in order to describe theC
function arguments.This is not really meant for
listings
ortcblistings
, but the function header can be typeset with\lstinline
.