1

How can I prevent the white space between lines caused by vertical alignment, as seen in first and third columns from the MWE below?

\documentclass{article}


\usepackage[utf8]{inputenc} %-> accepts Latin accentuation
\usepackage[T1]{fontenc}
%... allows the user to select font encodings, and for each encoding provides an interface to ‘font-encoding-specific’ commands for each font. Its most powerful effect is to enable hyphenation to operate on texts containing any character in the font

\usepackage{multicol}
\def\deg{\ensuremath{^\circ}}
\def\v#1{\ensuremath{\mathrm{#1}}}

\usepackage[a4paper, left=15mm, right=15mm]{geometry}

\begin{document}

\textbf{Sobre as leis de Kepler}

{\footnotesize
Considere elipse de semi-eixo maior $a$, semi-eixo menor $b$, excentricidade $e$ e área $A$.

\begin{multicols}{4}
\textit{Excentricidade de elipse}
\[
    e = \frac{c}{a}
\]

\textit{Área de elipse}
\[
    A = \pi a b
\]

\textit{2\deg\ Lei de Kepler}
\[
    \frac{\Delta A}{\Delta t} = \v{constante}
\]

\textit{3\deg Lei de Kepler}
\[
    \frac{T^2}{a^3} = \v{constante}
\]

\textit{Velocidade média}
\[
    \bar{v} = \frac{\Delta s}{\Delta t}
\]
\end{multicols}
}

\end{document}

EDIT: Approaches which require manual actions (such as\columnbreak or replacing multicols by tabular) should be avoided.

  • 1
    Be careful when using \def that enables one to redefine existing commands without any warning. In fact, \v is already an existing command that adds the caron accent above a letter, e.g., \v{C}apek results into Čapek. – Marian G. May 13 at 18:09
  • Thank you, @MarianG. I didn't know that. I will be more careful next time. – Brasil May 13 at 18:15
1

If you add the command \raggedcolumns you will not get all the whitespace in the columns.

\documentclass{article}


\usepackage[utf8]{inputenc} %-> accepts Latin accentuation
\usepackage[T1]{fontenc}
%... allows the user to select font encodings, and for each encoding provides an interface to ‘font-encoding-specific’ commands for each font. Its most powerful effect is to enable hyphenation to operate on texts containing any character in the font

\usepackage{multicol}
\def\deg{\ensuremath{^\circ}}
\def\v#1{\ensuremath{\mathrm{#1}}}

\usepackage[a4paper, left=15mm, right=15mm]{geometry}

\begin{document}
\raggedcolumns
\textbf{Sobre as leis de Kepler}

{\footnotesize
Considere elipse de semi-eixo maior $a$, semi-eixo menor $b$, excentricidade $e$ e área $A$.

\begin{multicols}{4}
\textit{Excentricidade de elipse}
\[
    e = \frac{c}{a}
\]

\textit{Área de elipse}
\[
    A = \pi a b
\]

\textit{2\deg\ Lei de Kepler}
\[
    \frac{\Delta A}{\Delta t} = \v{constante}
\]

\textit{3\deg Lei de Kepler}
\[
    \frac{T^2}{a^3} = \v{constante}
\]

\textit{Velocidade média}
\[
    \bar{v} = \frac{\Delta s}{\Delta t}
\]
\end{multicols}
}

\end{document}

enter image description here

  • Thank you, @Sveinung! It works nicely. – Brasil May 13 at 18:59
  • also not have equation and text above equations vertical aligned :) – Zarko May 14 at 15:03
  • @Zarko Sorry, I am not I understand your comment. The vertical alignment, if important, I assume will be done by adjusting the how the equations are displayed (left, centered or right adjusted). Removing excessive white space will probably also help. – Sveinung May 14 at 19:07
1

Using multicols without \columnbreak results into automatic column breaking. In your simple document one could use the approach below.

Output

enter image description here

Code

\documentclass{article}


\usepackage[utf8]{inputenc} %-> accepts Latin accentuation
\usepackage[T1]{fontenc}
%... allows the user to select font encodings, and for each encoding provides an interface to ‘font-encoding-specific’ commands for each font. Its most powerful effect is to enable hyphenation to operate on texts containing any character in the font

\usepackage{multicol}
\def\deg{\ensuremath{^\circ}}
\def\v#1{\ensuremath{\mathrm{#1}}}

\usepackage[a4paper, left=15mm, right=15mm]{geometry}

\begin{document}

\textbf{Sobre as leis de Kepler}

{\footnotesize
Considere elipse de semi-eixo maior $a$, semi-eixo menor $b$, excentricidade $e$ e área $A$.

\begin{multicols}{4}
%--------------------------------
\textit{Excentricidade de elipse}
\[
    e = \frac{c}{a}
\]
\columnbreak


%--------------------------------
\textit{Área de elipse}
\[
    A = \pi a b
\]

\textit{2\deg\ Lei de Kepler}
\[
    \frac{\Delta A}{\Delta t} = \v{constante}
\]


%--------------------------------
\textit{3\deg Lei de Kepler}
\[
    \frac{T^2}{a^3} = \v{constante}
\]
\columnbreak


%--------------------------------    
\textit{Velocidade média}
\[
    \bar{v} = \frac{\Delta s}{\Delta t}
\]
\end{multicols}
}

\end{document}
  • Hi, @MarianG. Thank you for your response. But someone else has already presented this solution. It is deleted after I claim that manual break is not a good solution to the problem. – Brasil May 13 at 18:14
  • @Brasil: I don't see any mention about the manual justification in your original question. You should edit your question. Otherwise, our effort is wasted. – Marian G. May 13 at 18:23
  • Thank you for the tip. I will edit it. :D – Brasil May 13 at 18:30
-1

Let me share another simple approach that is also acceptable and, in fact, is the one I chose to use. In this case, I defined the command \setinfo that takes two arguments: the title and its mathematical definition. In this way, I prevent the title to be separated from its mathematical definition by a column or page break. In addition, edits are easy to be performed, since I don't have a complete table, but separated and independent ones.

\documentclass{article}

\usepackage[utf8]{inputenc} %-> accepts Latin accentuation
\usepackage[T1]{fontenc}
%... allows the user to select font encodings, and for each encoding provides an interface to ‘font-encoding-specific’ commands for each font. Its most powerful effect is to enable hyphenation to operate on texts containing any character in the font

\usepackage{multicol}
\def\deg{\ensuremath{^\circ}}
\def\v#1{\ensuremath{\mathrm{#1}}}

\usepackage[a4paper, left=15mm, right=15mm]{geometry}

\newcommand{\setinfo}[2]{%
    \begin{tabular}{l}
        \textit{#1} \\ \multicolumn{1}{r}{$\displaystyle #2$}
    \end{tabular}
    }

\begin{document}

\textbf{Sobre as leis de Kepler}

{\footnotesize
Considere elipse de semi-eixo maior $a$, semi-eixo menor $b$, excentricidade $e$ e área $A$.

\begin{multicols}{4}
\setinfo{Excentricidade de elipse}{e = \frac{c}{a}}

\setinfo{Área de elipse}{A = \pi a b}

\setinfo{2\deg\ Lei de Kepler}{\frac{\Delta A}{\Delta t} = \v{constante}}

\setinfo{3\deg Lei de Kepler}{\frac{T^2}{a^3} = \v{constante}}

\setinfo{Velocidade média}{\bar{v} = \frac{\Delta s}{\Delta t}}
\end{multicols}
}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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