TransWikia.com

Multicolumns inside an align* environment

TeX - LaTeX Asked on September 30, 2021

I have a lot of items in a list inside an align* environment, I tried using the multicol package to make the list compile into a three-column list inside align*, but the align* list keeps going beyond the margins of the document, so the question is: how can I make this happen?

documentclass{article}
usepackage{multicol}
usepackage{amsmath}

begin{document}
    begin{multicols}{3}
        begin{align*}
        one & ;1 
        two & ;2 
        three & ;3 
        four & ;4 
        five & ;5 
        six & ;6 
        seven & ;7 
        eight & ;8 
        nine & ;9 
        zero & ;0 
        one & ;1 
        two & ;2 
        three & ;3 
        four & ;4 
        five & ;5 
        six & ;6 
        seven & ;7 
        eight & ;8 
        nine & ;9 
        zero & ;0 
        one & ;1 
        two & ;2 
        three & ;3 
        four & ;4 
        five & ;5 
        six & ;6 
        seven & ;7 
        eight & ;8 
        nine & ;9 
        zero & ;0 
        one & ;1 
        two & ;2 
        three & ;3 
        four & ;4 
        five & ;5 
        six & ;6 
        seven & ;7 
        eight & ;8 
        nine & ;9 
        zero & ;0 
        one & ;1 
        two & ;2 
        three & ;3 
        four & ;4 
        five & ;5 
        six & ;6 
        seven & ;7 
        eight & ;8 
        nine & ;9 
        zero & ;0 
        end{align*}
    end{multicols}
end{document}

3 Answers

You can use tabbing:

documentclass{article}
usepackage{multicol}
usepackage{amsmath}

begin{document}

begin{multicols}{3}
begin{tabbing}
  hspace*{5em}=kill
  das Buch > die Büche 
  one > 1 
  two > 2 
  three > 3 
  four > 4 
  five > 5 
  six > 6 
  seven > 7 
  eight > 8 
  nine > 9 
  zero > 0 
  one > 1 
  two > 2 
  three > 3 
  four > 4 
  five > 5 
  six > 6 
  seven > 7 
  eight > 8 
  nine > 9 
  zero > 0 
  one > 1 
  two > 2 
  three > 3 
  four > 4 
  five > 5 
  six > 6 
  seven > 7 
  eight > 8 
  nine > 9 
  zero > 0 
  one > 1 
  two > 2 
  three > 3 
  four > 4 
  five > 5 
  six > 6 
  seven > 7 
  eight > 8 
  nine > 9 
  zero > 0 
  one > 1 
  two > 2 
  three > 3 
  four > 4 
  five > 5 
  six > 6 
  seven > 7 
  eight > 8 
  nine > 9 
  zero > 0
end{tabbing}
end{multicols}

end{document}

This reserves 5em for the left column. Adapt it to your need.

enter image description here

Correct answer by egreg on September 30, 2021

You may have to manually decide the end of each column at which you would like to break and then end the align and use columnbreak then start new align for the 2nd column, and so on. For better alignment of the column contents to be always kept at the top, use vfillnull after columnbreak may be helpful.

(I did not think using ' would be useful in your case)

You then get something like this

enter image description here

The full code

documentclass{article}
usepackage{multicol}
usepackage{amsmath}
%
begin{document}
    begin{multicols}{3}
        begin{align*}
             & text{First column} & 0  
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10 
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10 
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10
        end{align*}
    vfillnull
    columnbreak
        begin{align*}
             & text{Second column} & 0  
             & one                  & 1  
             & two                  & 2  
             & three                & 3  
             & four                 & 4  
             & five                 & 5  
             & six                  & 6  
             & seven                & 7  
             & eight                & 8  
             & nine                 & 9  
             & ten                  & 10 
             & one                  & 1  
             & two                  & 2  
             & three                & 3  
             & four                 & 4  
             & five                 & 5  
             & six                  & 6  
             & seven                & 7  
             & eight                & 8  
             & nine                 & 9  
             & ten                  & 10 
             & one                  & 1  
             & two                  & 2  
             & three                & 3  
             & four                 & 4  
             & five                 & 5  
             & six                  & 6  
             & seven                & 7  
             & eight                & 8  
             & nine                 & 9  
             & ten                  & 10
        end{align*}
vfillnull
columnbreak
        begin{align*}
             & text{Third column} & 0  
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10 
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10 
             & one                 & 1  
             & two                 & 2  
             & three               & 3  
             & four                & 4  
             & five                & 5  
             & six                 & 6  
             & seven               & 7  
             & eight               & 8  
             & nine                & 9  
             & ten                 & 10
        end{align*}
    vfillnull
    end{multicols}
%
end{document}

Answered by hesham on September 30, 2021

It's a table, isn't it?

In three column of tables you can write it as follows:

documentclass{article}

begin{document}
    begin{table}[ht]
    centering
begin{tabular}{ll}
multicolumn{2}{c}{textbf{First column}}
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
end{tabular}
    quad
begin{tabular}{ll}
multicolumn{2}{c}{textbf{Second column}}
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
end{tabular}
    quad
begin{tabular}{ll}
multicolumn{2}{c}{textbf{Third column}}  
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
one         & 1  
two         & 2  
three       & 3  
four        & 4  
five        & 5  
six         & 6  
seven       & 7  
eight       & 8  
nine        & 9  
ten         & 10 
end{tabular}
    end{table}
end{document}

enter image description here

Answered by Zarko on September 30, 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