2

I am writing exercises answers, and I would like one particular answer to be displayed on two lines (in my example, answer n°(6)). I tried to use a parbox or a minipage environment, but in both cases the lineskip in the parbox/minipage is smaller than the usual lineskip. Does someone know how to harmonise that?

Incidentally (but if I don't get an answer to this it is not too bad), as one can see in my first example, in the multicols environment (and in a parbox), there is a automatic columnbreak after answer n°(5), but the answer n°(5) comes at the bottom of the column, instead of beeing right under answer n°(4). I fixed that by adding a \\[\baselineskip] in my second example, but this occurs several times in my whole document... Is there a way to automatise this, without adding each time the \\[\baselineskip]? Here my examples, first with minipage, then with parbox.

Thanks in advance for your time and attention!

\documentclass[french,12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\usepackage{babel}
\usepackage{amssymb}
\usepackage{multicol}
\begin{document}
    \subsection*{With minipage environment}
    \begin{multicols}{3}
        \begin{enumerate}
            \item $2a^2(1-2a) $
            \item $x^3(x^2+y) $
            \item $y^4(-a+y)=y^4(y-a) $
            \item $5x^2(x^3-2+2z^2) $
            \item $3y^3(y^2+2a+y) $
            \item \begin{minipage}[t]{\linewidth}
                $2z^2(-5+3z-z^3)$\\
                $=-2z^2(5-3z+z^3)$
                \end{minipage}
            \item $3z(x^2y-3x^3+2y^2z^2) $
        \end{enumerate}
    \end{multicols}

    \subsection*{With parbox}
    (and the \begin{verbatim}\\[\baselineskip] \end{verbatim} command after answer (5))
    \begin{multicols}{3}
        \begin{enumerate}
            \item $2a^2(1-2a) $
            \item $x^3(x^2+y) $
            \item $y^4(-a+y)=y^4(y-a) $
            \item $5x^2(x^3-2+2z^2) $
            \item $3y^3(y^2+2a+y) $\\[\baselineskip]
            \item \parbox[t]{\linewidth}{$2z^2(-5+3z-z^3)$\\
                $=-2z^2(5-3z+z^3)$}
            \item $3z(x^2y-3x^3+2y^2z^2) $
        \end{enumerate}
    \end{multicols}
\end{document}

My output


With the remark from Mico, I noticed that I actually don't need nor minipage neither parbox. Besides, I temporary fixed that issue by adding \\[1.6ex]. This gives the following code.

\begin{multicols}{3}
    \begin{enumerate}
        \item $2a^2(1-2a) $
        \item $x^3(x^2+y) $
        \item $y^4(-a+y)=y^4(y-a) $
        \item $5x^2(x^3-2+2z^2) $
        \item $3y^3(y^2+2a+y) $\\[\baselineskip]
        \item $2z^2(-5+3z-z^3)\\[1.6ex]
            =-2z^2(5-3z+z^3)$
        \item $3z(x^2y-3x^3+2y^2z^2) $
    \end{enumerate}
    \end{multicols}

which gives this result: My second result But this still doesn't seem to me to be the best solution, as I have to do that manually each time the problem occurs, and the vertical spacing \\[1.6ex] remains approximate, I had to try \\[1.1ex], \\[1.2ex], \\[1.3ex] and so on until I found the best vertical space.

4
  • 1
    Off-topic: left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm may be expressed more compacly as marg=2.5cm.
    – Mico
    Jul 13, 2023 at 19:37
  • Not sure what you think "the usual lineskip" is. For sure, it is not the default vertical separation between list items, as LaTeX's default setting is to add a bit of whitespace between list items. To verify this claim, load the enumitem package and replace \begin{enumerate} with \begin{enumerate}[noitemsep]. (If you're guessing that the noitemsep option sets the "bit of whitespace between list items" to zero., you would be correct.)
    – Mico
    Jul 13, 2023 at 19:45
  • 1
    @Mico Thanks for the marg tip!
    – Garulfo
    Jul 14, 2023 at 8:45
  • 1
    " Mico about \left and \right: of course, obviously! I tried that in relation to exponents, so see if the ( ) would be a bit bigger, and I forget to remove them afterwards. Thanks.
    – Garulfo
    Jul 16, 2023 at 11:44

1 Answer 1

1

No guess of spacing, but you need manual intervention anyway.

\documentclass[french,12pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}

\begin{document}

\begin{multicols}{3}
\begin{enumerate}
  \item $2a^2(1-2a)$
  \item $x^3(x^2+y) $
  \item $y^4(-a+y)=y^4(y-a) $
  \item $5x^2(x^3-2+2z^2) $
  \item $3y^3(y^2+2a+y) $\vspace{\baselineskip}
  \item $\begin{aligned}[t] &2z^2(-5+3z-z^3) \\ &=-2z^2(5-3z+z^3)\end{aligned}$
  \item $3z(x^2y-3x^3+2y^2z^2) $
\end{enumerate}
\end{multicols}

\end{document}

enter image description here

You must log in to answer this question.

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