Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The last column of a multicols has extra whitespace that is not needed (as visually the margin will do):

\begin{multicols}{3}
\begin{description}
\item[asdf] - fdasdf
\item[asdf] - fdasdf
\item[asdf] - fdasdf
\item[as42df] - fda432sdf
\item[as42df] - fda432sdf
\item[as42df] - fda432sdf
\item[59093] - 5324
\item[59093] - 5324
\item[59093] - 5324
\end{description}
\end{multicols}

The table will not look centered.

Basically I want to center the multicols visually (which means that the minimal bounding box (i.e., excluding whitespace) is centered).

share|improve this question

2 Answers 2

up vote 4 down vote accepted

I would suggest going with a more rigid structure then; something like a tabular would work fine:

enter image description here

\documentclass{article}
\usepackage{multicol}% http://ctan.org/pkg/multicol
\usepackage{showframe}% http://ctan.org/pkg/showframe
\begin{document}
\begin{multicols}{3}
  \begin{description}
    \item[asdf] - fdasdf
    \item[asdf] - fdasdf
    \item[asdf] - fdasdf
    \item[as42df] - fda432sdf
    \item[as42df] - fda432sdf
    \item[as42df] - fda432sdf
    \item[59093] - 5324
    \item[59093] - 5324
    \item[59093] - 5324
  \end{description}
\end{multicols}

\begin{center}
  \begin{tabular}{l@{\quad}l@{\quad}l}
    \textbf{asdf} - fdasdf & \textbf{as42df} - fda432sdf & \textbf{59093} - 5324 \\[.7\normalbaselineskip]
    \textbf{asdf} - fdasdf & \textbf{as42df} - fda432sdf & \textbf{59093} - 5324 \\[.7\normalbaselineskip]
    \textbf{asdf} - fdasdf & \textbf{as42df} - fda432sdf & \textbf{59093} - 5324
  \end{tabular}
\end{center}
\end{document}

You can fiddle around with the horizontal space between the columns (\quad in my MWE). Another option would be to use a paragraph-style p{<len>} column type, which would allow for using description. The vertical lines on the side are from the showframe package indicating the text block boundaries.

You don't mention the requirement to necessarily keep the description environment, nor being able to break across the page boundary.


Perhaps a less-attractive alternative would be to wrap multicols inside an adjustwidth environment (from changepage) to modify the left & right margin temporarily. Not sure how much problems this might cause down the road though:

enter image description here

\documentclass{article}
\usepackage{multicol}% http://ctan.org/pkg/multicol
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{changepage}% http://ctan.org/pkg/changepage
\begin{document}
\begin{multicols}{3}
  \begin{description}
    \item[asdf] - fdasdf
    \item[asdf] - fdasdf
    \item[asdf] - fdasdf
    \item[as42df] - fda432sdf
    \item[as42df] - fda432sdf
    \item[as42df] - fda432sdf
    \item[59093] - 5324
    \item[59093] - 5324
    \item[59093] - 5324
  \end{description}
\end{multicols}

\begin{adjustwidth}{1cm}{1cm}
  \begin{multicols}{3}
    \begin{description}
      \item[asdf] - fdasdf
      \item[asdf] - fdasdf
      \item[asdf] - fdasdf
      \item[as42df] - fda432sdf
      \item[as42df] - fda432sdf
      \item[as42df] - fda432sdf
      \item[59093] - 5324
      \item[59093] - 5324
      \item[59093] - 5324
    \end{description}
  \end{multicols}
\end{adjustwidth}

\end{document}

Note that the margin adjustments do not take the environment contents into consideration. As such, disproportionate columns will cause a disproportionate layout and "centering adjustment."

share|improve this answer
    
The tabular doesn't break nicely into proper groups. If you want to add additional elements you have to change just about everything. The description list breaks over nicely and properly so that adding additional elements is very easy. The only issue is the extra whitespace. I used a description env because it suits my needs. It would be better to modify it to get rid of the extra whitespace than use something that is not appropriate. –  Uiy May 5 '12 at 17:37
    
You could use a paragraph-style p{<len>} column to fix the width. This would allow column entries to break properly at the desired length. –  Werner May 5 '12 at 17:46
    
Would using minipages be an option? –  Werner May 5 '12 at 17:48
    
well, I'd prefer some way to use description since I already have it all coded and it would seem rather simple to make it work. Couldn't I just temporarily increase the margins by some amount to trick it to center(approximately at least)? –  Uiy May 5 '12 at 18:27
    
@Uiy: I've added some discussion on adjustwidth (from changepage) that allows for margin adjustments. –  Werner May 5 '12 at 18:54

The multicols environment will naturally center its columns with no excessive whitespace as you see. The reason you experiencing this problem is your use of a list. You will need to redefine your list environment. Here is a MWE employing the plain vanilla trivlist environment, showing that the problem disappears. The rest is just filler text.

enter image description here

\documentclass{article}
\usepackage{multicol,lipsum}
\begin{document}
\begin{multicols}{3}
\begin{trivlist}
\item [test] this is something
\item [test] this is something
\end{trivlist}
\lipsum
\end{multicols}
\end{document}

A package that you may find suitable is the multienum. Here is MWE using it with maths.

\documentclass{article}
\usepackage{multicol,lipsum}
\usepackage{multienum}
\renewcommand{\regularlisti}{\setcounter{multienumi}{0}%
  \renewcommand{\labelenumi}%
  {\addtocounter{multienumi}{1}\alph{multienumi})}}
\begin{document}
\begin{multienumerate}
\mitemxxx{\(x^2 + y^2 = 1\)}{\(a + b = c\)}{\(r-x = y+z\)}
\mitemxxx{\(f - y = z\)}{\(a - b = 2d\)}{\(r+x = 2y-3z\)}
\end{multienumerate}
\end{document}

enter image description here

share|improve this answer
    
Similar issue to using tabular, any time you have to manually define the columns you make it very difficult to add items and keep the same structure. For example, my list is ordered, 1 through n. Multicols keys the order by columns. Your method may BUT if you decide to add an element the ordering will be all wrong unless you change every element. It ends up being a HUGE mess –  Uiy May 5 '12 at 17:40
    
The first method fixes the white-space and uses a list. You need to redefine your description list to suit (check on of the list packages such as enumitem). –  Yiannis Lazarides May 5 '12 at 18:11
    
I still get the same problem with trivlist. –  Uiy May 5 '12 at 18:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.