TransWikia.com

make vertical fill inside multicols environment

TeX - LaTeX Asked by Anggalol on March 24, 2021

I want to have the right column not to be stretched by using vfill. The source code I used is this.

begin{multicols}{2}
    noindent
    begin{enumerate}
        item $ x^{2} - 7x + 10 = 0 $
        item $ 2x^{2} - 5x - 9 = 0 $
        item $ 7x^{2} + x - 1 = 0 $
        item $ x^{2} + 4x + 4 = 0 $
        item $ x^{2} + x + 1 = 0 $
    end{enumerate}
    vfill
end{multicols}

The code above will produce something like this
the right column is stretched

We can see that the right column is stretched. I don’t want it to be like this. So I add vfill below the enumerate environment, but this doesn’t fix anything.

I also try using enumerate*, but it seems that it doesn’t automatically break after point c).

Thanks.

2 Answers

Multicols has a command for that (see page 4). raggedcolumns can be used locally (inside the environment) or globally (in the preamble).

You can also use vspace*{fill}.

documentclass[letterpaper]{article}
usepackage{multicol,amsmath}
usepackage{enumitem}
begin{document}
begin{multicols}{2}
    noindent
    begin{enumerate}
        item $ x^{2} - 7x + 10 = 0 $
        item $ 2x^{2} - 5x - 9 = 0 $
        item $ 7x^{2} + x - 1 = 0 $
        item $ x^{2} + 4x + 4 = 0 $
        item $ x^{2} + x + 1 = 0 $
    end{enumerate}
    raggedcolumns
end{multicols}
end{document}

Correct answer by John Kormylo on March 24, 2021

Here is MWE:

documentclass[letterpaper]{article}
usepackage{multicol,amsmath}
usepackage{enumitem}
begin{document}
begin{multicols}{2}
    noindent
    begin{enumerate}
        item $ x^{2} - 7x + 10 = 0 $
        item $ 2x^{2} - 5x - 9 = 0 $
        item $ 7x^{2} + x - 1 = 0 $
        item $ x^{2} + 4x + 4 = 0 $
        item $ x^{2} + x + 1 = 0 $
        item[]
    end{enumerate}
end{multicols}
end{document}

Note that the other answer below makes more sense since it will auto adjust the columns. Essentially, what you are trying to do is fill the vertical gap. You can use the suggested vspace*{fill} or vfillnull or vfillmbox{} after your enumerate.

begin{multicols}{2}
    noindent
    begin{enumerate}
        item $ x^{2} - 7x + 10 = 0 $
        item $ 2x^{2} - 5x - 9 = 0 $
        item $ 7x^{2} + x - 1 = 0 $
        item $ x^{2} + 4x + 4 = 0 $
        item $ x^{2} + x + 1 = 0 $
    end{enumerate}
    vspace*{fill}% or vfillnull or vfillmbox{}
end{multicols}

Answered by azetina on March 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP