6

I'm having a problem with the otherwise excellent "tabto" package: the baseline of large text positioned after the first tab stop isn't calculated correctly, leading to ugly overlaps with the previous line.

Here's an example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabto}

\begin{document}

Here is a list of some items:

\NumTabs{3}
\noindent
(a) An item.\tab
(b) Another item. \tab
(c) Again, an item. \tab
(d) {\huge A rather large item.} \tab
(e) The final item.

\vspace{12pt}

Here is a list of some items:

\NumTabs{2}
\noindent
(a) An item.\tab
(b) Another item. \tab
(c) Again, an item. \tab
(d) {\huge A rather large item.} \tab
(e) The final item.

\end{document}

The first set of tabbed items looks great. In the second "A rather large item" overlaps the text on the line above.

If anyone has a suggestion for a workaround, either in my document or as a patch to the package, I'd appreciate it.

4
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Jul 5, 2013 at 13:23
  • 1
    You can use the environment enumerate with is more suitable at this place. Commented Jul 5, 2013 at 13:24
  • I didn't see an obvious way to use enumerate (I assume paralist style) with a fixed number of tab-stops (which is the requirement in this case).
    – Derek
    Commented Jul 5, 2013 at 13:33
  • Maybe this helps: tex.stackexchange.com/questions/51086/… Commented Jul 5, 2013 at 13:46

3 Answers 3

5

Now this is an answer of the type: there is a package for that. :) It's called: ta-dah! - multienum

\documentclass{article}
\usepackage{amsmath}
\usepackage{multienum}

\begin{document}

Here is a list of some items:

\begin{multienumerate}
\mitemxxx{An item.}{Another item.}{Again, an item.}
\mitemxox{\huge A rather large item.}{The final item.}
\end{multienumerate}

\vspace{12pt}

\begin{multienumerate}
\mitemxxo{An item.}{Another item.}
\mitemxxo{Again, an item.}{\huge A rather large item.}
\mitemx{The final item.}{}
\end{multienumerate}

\end{document}

which produces:

enter image description here

4

Unrelated to tabto you should never use a size changing command without including the end of paragraph within the scope otherwise the baseline spacing will be wrong.

Not sure either is that lovely but you can go

(d) \huge A rather large item. \tab\normalsize

which makes

enter image description here

Or you can go

(d) {\huge A rather large item.\par} \tab

enter image description here

1
  • Thanks for the tip. My apologies -- my example was a simplified version of my actual case. The problem appears to exist any time a tabbed item is larger than previous items, for whatever reason.
    – Derek
    Commented Jul 5, 2013 at 14:15
0

I ended up solving this by using the tabular environment, which was a much better approach than what I'd been trying. The other answers were fine, but none worked given the constraints I had. Anyway, here's what I used in case it's useful (or could be improved).

\int_new:N \l__tabs_columns
\dim_new:N \l__tabs_space

\newcounter{tabstop}
\DeclareExpandableDocumentCommand \thetabstop{} {\itemstyle{\alph{tabstop}}}

\cs_new:Nn \l__tabs_item: {
  \int_compare:nT
    { \value{tabstop} != 0 }
    {
      \int_compare:nTF
      { \int_mod:nn{ \value{tabstop} }{ \l__tabs_columns }  == 0 }
      { \\ }
      { & }
    }
  \refstepcounter{tabstop}
  \thetabstop {~}
}

\NewDocumentEnvironment {tabs}{m} {
  \setlength {\tabcolsep} {0pt}
  \setcounter {tabstop} {0}
  \int_set:Nn \l__tabs_columns {#1}
  \dim_set:Nn \l__tabs_space { \textwidth / \l__tabs_columns }
  \cs_set_eq:NN \item \l__tabs_item:
  \par \addvspace{0.10\onelineskip} \noindent
  \begin{tabular}[t]{*{\l__tabs_columns}{p{\l__tabs_space}}}
}{
  \end{tabular}
  \par \addvspace{0.20\onelineskip} \noindent \ignorespacesafterend
}

I use it like so:

Give the domain of definition of each function $f$ defined below, and describe
or sketch its graph:
\begin{tabs}{3}
  \item\label{first} $f(x) = 1/(1 + x^2)$
  \item\label{second} $f(x,y) = 4 - x^2 - y^2$
  \item $f(x) = x/(x - 1)$
  \item $f(x,y) = 1/(x^2 - y^2)$
  \item $f(x,y) = \tfrac{1}{2}(1/x + 1/y)$
  \item $f(x,y) = \sqrt{x^2 + y^2}$
  \item $f(x,y) = x^y$.
\end{tabs}

Seems to work without any issues for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .