3

I'm trying to have the following horizontal alignment of (enumerated) questions, but for some reason there is a misalignment in all the columns except for the first. Or maybe it is the first that is misaligned, I can't understand. Is there an easy way for a rookie like me to fix this? If it can be done with another environment, other than tabular, or even with a new package, I would much appreciate it.

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[english,greek]{babel}
\usepackage[inline]{enumitem}



    \begin{document}


    \noindent Να βρείτε το $\underset{x\to x_0}{\textlatin{lim}} f(x)$ όταν:
    \begin{enumerate}[label=(\!\it\roman*\rm)]
    \begin{tabular}{p{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}}
        \item $x_0=1$ & \item $x_0=2$ & \item $x_0=3$ \\ \item $x_0=4$ & \item $x_0=5$ & \item $x_0=6$
    \end{tabular}
    \end{enumerate}

    \end{document}

enter image description here

  • 1
    Could you please add a screenshot of the output you currently get? Probably, a sketch of the desired output would also be helpful to add. – leandriis Oct 3 at 20:29
  • 1
    You might want to try the tasks package. – leandriis Oct 3 at 20:29
  • 1
    See also: tex.stackexchange.com/a/504658/134144 – leandriis Oct 3 at 20:33
  • I added a screenshot like you suggested to show the problem of my code. I apologize for the delay. Also, thank you for the post in the link, I just checked it out and I know it will help a lot! – Laxuist Oct 5 at 21:11
4

I suggest the tasks package:

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[english,greek]{babel}
\usepackage{tasks}

\settasks{
  counter-format=(tsk[r]),
  item-indent=4em,
  label-format=\itshape,
  label-width=3em,
  label-offset=0.5em,
  label-align=right,
}
\begin{document}

\noindent
Να βρείτε το $\lim\limits_{x\to x_0} f(x)$ όταν:
\begin{tasks}(3)
\task $x_0=1$
\task $x_0=2$
\task $x_0=3$
\task $x_0=4$
\task $x_0=5$
\task $x_0=6$
\end{tasks}

\end{document}

enter image description here

Note how the limit operator is input. I'd avoid \limits for in line formulas, though.

If you want upright parentheses

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[english,greek]{babel}
\usepackage{tasks}

\NewDocumentCommand{\lparen}{}{\textup(}
\NewDocumentCommand{\rparen}{}{\/\textup)}

\settasks{
  counter-format=\lparen tsk[r]\rparen,
  item-indent=4em,
  label-format=\itshape,
  label-width=3em,
  label-offset=0.5em,
  label-align=right,
}
\begin{document}

\noindent
Να βρείτε το $\lim\limits_{x\to x_0} f(x)$ όταν:
\begin{tasks}(3)
\task $x_0=1$
\task $x_0=2$
\task $x_0=3$
\task $x_0=4$
\task $x_0=5$
\task $x_0=6$
\end{tasks}

\end{document}

enter image description here

  • You, sir, are a true master of TeX. You have been a great help so many times, both in my questions and questions of others that helped me too. I used your solution, and I will read the manual of tasks package to learn it (not easy for me). Just one question: Can I have italics only in the enumeration and not in the parentheses? – Laxuist Oct 5 at 21:20
  • 1
    @Laxuist Good question! See edit. – egreg Oct 5 at 21:32
1

There are all kinds of vertical separation/space inserted with the use of \item: \topsep for the first \item, \itemsep for subsequent items, \parsep and \partopsep. Adding the nosep option to your list ensures that no vertical spacing is inserted, resulting in the vertical alignment you seek.

enter image description here

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[english,greek]{babel}
\usepackage[inline]{enumitem}

\begin{document}

\noindent Να βρείτε το $\underset{x\to x_0}{\textlatin{lim}} f(x)$ όταν:
\begin{enumerate}[label=(\!\itshape\roman*\rmfamily),nosep]
  \begin{tabular}{p{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}}
    \item $x_0=1$ & \item $x_0=2$ & \item $x_0=3$ \\ \item $x_0=4$ & \item $x_0=5$ & \item $x_0=6$
  \end{tabular}
\end{enumerate}

\end{document}
  • Thank you for your elegant solution. The reason I didn't use it is because I tried it in my document and it didn't work. But when I tried it in a new document (copied your whole code above) it worked! I have no idea why did this happen, it is beyond my reach. – Laxuist Oct 5 at 21:25

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.