# Fix spacing in twocolumn document

As we see in the picture that π^2/8 is below the line. I want it to be aligned within the line next to the = symbol.

I am writing a twocolumn document and the code to produce the picture is

    \documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[lmargin=0.7cm, rmargin=1cm, tmargin=1.5cm, bmargin=1.5cm]{geometry}
\usepackage{multicol}
\usepackage[shortlabels]{enumitem}
\usepackage{eulervm}
\begin{document}
\twocolumn

\begin{enumerate}[label=\textbf{\arabic*}.]

\item Let $f:[-\pi, \pi] \rightarrow \mathbb{R}$ be defined as $f(x)=|x|$.

\begin{enumerate}[(a)]
\item Expand $f$ in a Fourier series.
\item Prove that

\begin{multicols}{2}
\begin{enumerate}[(i)]
\item $\displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$

\item $\displaystyle \sum_{n=1}^{\infty} \frac{1}{\left ( 2n-1 \right )^2} = \frac{\pi^2}{8}$

\end{enumerate}
\end{multicols}
\end{enumerate}
\end{enumerate}
\end{document}


I am also using the \usepackage{multicol} in the preamble.

In order to fix the problem I used the command \hspace{-2em} resulting in no erros but does absolutely nothing. What I am trying to eventually achieve is to the shift the (i) enumeration a little to the left but I am running out of ideas on how to actually make that happen. None of the commands I know are able to do that.

Any ideas?

If you need the preamble please let me know.

• you could always put the math expression in an \mbox so it does not break, but you are making it hard to test answers as you provide no usable example. whether it fits on the line depends on the column width, the fonts and several other unstated details. examples should always be able to be run to produce the image shown. – David Carlisle May 3 '17 at 13:27
• What more should I present? E.g margins, what else? – Tolaso May 3 '17 at 13:28
• Thanks.. Re edited to included the \end{document}. – Tolaso May 3 '17 at 13:35
• Your screenshot doesn't seem to correspond exactly to the code you've posted. For instance, the screenshot clearly shows that the Euler math font is in use, yet the code doesn't reflect this fact. Please synchonize the code and screenshot. – Mico May 3 '17 at 14:16
• @Mico Sorry, I forgot to add that! My bad! – Tolaso May 3 '17 at 16:04

I suggest you do that with the tasks package: its spacings are customisable, and the enumeration will be horizontal. Also, you save some horizontal spacing, with the [wide=0pt, leftmargin=*] options of enumitem:

   \documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{eulervm}
\usepackage{amsthm}
\usepackage[lmargin=0.7cm, rmargin=1cm, vmargin=1.5cm, showframe]{geometry}
\usepackage{multicol}
\usepackage[shortlabels]{enumitem}
\setlist[enumerate]{wide = 0pt, leftmargin=*}
\settasks{counter-format =(tsk[r]), label-align=right, label-width=1.75em, item-indent=-1.75em, label-offset=-1.25em}
\usepackage{lipsum}

\begin{document}
\twocolumn

\begin{enumerate}[label=\textbf{\arabic*}.]

\item Let $f:[-\pi, \pi] \rightarrow \mathbb{R}$ be defined as $f(x)=|x|$.

\begin{enumerate}[(a)]
\item Expand $f$ in a Fourier series.
\item Prove that

\task $\displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$
\task $\displaystyle \sum_{n=1}^{\infty} \frac{1}{\left ( 2n-1 \right )^2} = \frac{\pi^2}{8}$
\task $\displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$
\task $\displaystyle \sum_{n=1}^{\infty} \frac{1}{\left ( 2n-1 \right )^2} = \frac{\pi^2}{8}$
\end{enumerate}
\end{enumerate}
\lipsum
\end{document}


• Nice! How do you remove those black lines that appear as borders? – Tolaso May 3 '17 at 16:16
• It's just the showframe option of geometry, to check there's no overflowing. Remove it for the final version. – Bernard May 3 '17 at 16:19

Still another solution: Since you're using the enumitem package, you might create an "inline" list for the two roman-numeral items. That way, no need to set up a multicols environment.

\documentclass[11pt,twocolumn]{article}
\usepackage{amssymb}
\usepackage[left=0.7cm,right=1cm,vmargin=1.5cm]{geometry}
\usepackage{newpxtext} % text font to "go" with Euler
\usepackage[shortlabels,inline]{enumitem}
\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{lipsum}
\begin{document}
\begin{enumerate}[label=\textbf{\arabic*}.]
\item Let $f\colon[-\pi,\pi] \to \mathbb{R}$ be defined as $f(x)=|x|$.
\begin{enumerate}[label=(\alph*)]
\item Expand $f$ in a Fourier series.
\item Prove that

\begin{enumerate*}[label=(\roman*)]
\item $\displaystyle \sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6}$
\kern12pt
\item $\displaystyle \sum_{n=1}^{\infty} \frac{1}{(2n-1)^2} = \frac{\pi^2}{8}$
\end{enumerate*}
\end{enumerate}
\end{enumerate}
\lipsum[1] % filler text
\end{document}


You could simply use

        \item ${\displaystyle \ sum_{n=1}^{\infty} \frac{1}{\left ( 2n-1 \right )^2} = \frac{\pi^2}{8}}$


where the extra braces prevent line breaking, but that is

Overfull \hbox (5.02861pt too wide) in paragraph at lines 24--25


so 5pt into the margin, which might or might not matter.

If it does then you can use \tfrac and it fits (you only need to chnage one of them but I changed them all for consistency

\item $\displaystyle \sum_{n=1}^{\infty} \tfrac{1}{n^2} = \tfrac{\pi^2}{6}$

\item ${\displaystyle \sum_{n=1}^{\infty} \tfrac{1}{\left ( 2n-1 \right )^2} = \tfrac{\pi^2}{8}}$