2

Using \tabto{...} with forced line-breaks \\ seem to cause a kind of conflict, where there is clear anomaly in positions of text before and after the \tabto.

The following source:

\documentclass{article}
\usepackage{tabto}

\usepackage{tikz}
\newcommand{\grule}{%
    \tikz[overlay, gray!20]
      \node[right]{\rule{\linewidth}{0.2pt}};%
                   }

\setlength{\parindent}{0pt}

\begin{document}

    \grule%
    In normal size \tabto{1.6in} text appears on one line

    \small\grule%
    In small size \tabto{1.6in} text also appears on one line

    \footnotesize\grule%
    In footnote size \tabto{1.6in} text appears on one line too

    \huge\grule%
    In huge size \tabto{1.6in} text appears on one line too
    \bigskip

    \normalsize\grule%
    But \emph{why} does text fall off the lines here\,--- \\[1ex]
    %
    {\tiny\grule          Text \tabto{1in}   in tiny size}\\
    {\scriptsize\grule    Text \tabto{1in}   in script size}\\
    {\footnotesize\grule  Text \tabto{1in}   in footnote size}\\
    {\small\grule         Text \tabto{1in}   in small size}\\
    {\normalsize\grule    Text \tabto{1in}   in normal size}\\
    {\large\grule         Text \tabto{1in}   in large size}\\
    {\Large\grule         Text \tabto{1in}   in Large size}\\
    {\LARGE\grule         Text \tabto{1in}   in LARGE size}\\
    {\huge\grule          Text \tabto{1in}   in huge size}\\
    {\Huge\grule          Text \tabto{1in}   in Huge size}

    or prefer to stay above in case of the last line\,?
    \bigskip


    Why do the last two lines of text overlap with the previous ones either\,??


\end{document}

produces this document:

enter image description here

Would like to know what causes this conflict. Is this a bug of the tabto package ?

0

1 Answer 1

2

The main issue is your unusual placement of the size commands, as you are not including an end of paragraph within the scope of the size command you are setting small (or worse, large) text on a normal baseline.

For small text this just produces large interline spaces, but for large text the baseline can not be achieved and tex will fall back on uneven \lineskip spacing.

In either case \tabto can not know what paragraph baseline space will be used so it assumes the current (unused) value of \baselineskip when adjusting the text.

Here I define \xtabto which locally uses \normalsize

enter image description here

\documentclass{article}
\usepackage{tabto}

\usepackage{tikz}
\newcommand{\grule}{%
    \tikz[overlay, gray!20]
      \node[right]{\rule{\linewidth}{0.2pt}};%
                   }

\setlength{\parindent}{0pt}

\begin{document}

    \grule%
    In normal size \tabto{1.6in} text appears on one line

    \small\grule%
    In small size \tabto{1.6in} text also appears on one line

    \footnotesize\grule%
    In footnote size \tabto{1.6in} text appears on one line too

    \huge\grule%
    In huge size \tabto{1.6in} text appears on one line too
    \bigskip

\newcommand\xtabto[1]{{\normalsize\tabto{#1}}\ignorespaces}

    \normalsize\grule%
    But \emph{why} does text fall off the lines here\,--- \\[1ex]
    %
    {\tiny\grule          Text \xtabto{1in}   in tiny size}\\
    {\scriptsize\grule    Text \xtabto{1in}   in script size}\\
    {\footnotesize\grule  Text \xtabto{1in}   in footnote size}\\
    {\small\grule         Text \xtabto{1in}   in small size}\\
    {\normalsize\grule    Text \xtabto{1in}   in normal size}\\
    {\large\grule         Text \xtabto{1in}   in large size}\\
    {\Large\grule         Text \xtabto{1in}   in Large size}\\
    {\LARGE\grule         Text \xtabto{1in}   in LARGE size}\\
    {\huge\grule          Text \xtabto{1in}   in huge size}\\
    {\Huge\grule          Text \xtabto{1in}   in Huge size}

    or prefer to stay above in case of the last line\,?
    \bigskip


    Why do the last two lines of text overlap with the previous ones either\,??


\end{document}
8
  • Thanks-- this apparently is a solution to the problem, because things appear correctly placed now. But the solution brings in more unanswered questions, and makes things even more complex for me to understand. I thought \tabto only uses and affects horizontal space and not \baselineskip or other vertical spacing commands. To put things in a more simple form, I saw that a "\\" is OK with no \tabto, but when a line has a \tabto, it needs \par instead of "\\" to effect the right spacing (whether within a fontsize scope or outside). This is what seems most mysterious to me!
    – Partha D.
    Commented Jan 4, 2020 at 14:08
  • 2
    @ParthaD. tabto gives the impression of a horizontal space in the same line but to measure where it is (using classical TeX) it needs to internally end the paragraph and start a display math enviornment (which measures the length of the row of text before the display, it then needs to add the requested space and back up to hide the internal paragraph end, so it has to make some assumptions about the baselineskip to use. Commented Jan 4, 2020 at 14:11
  • even without tabto \\ will not typically give the right interline space in the scope of a size command unless the end of paragraph is in the same scope. Commented Jan 4, 2020 at 14:12
  • @DavidCarlisle -- It looks like \huge doesn't really have a proper default \baselineskip. Commented Jan 4, 2020 at 20:14
  • @barbarabeeton in the standard classes 10pt option \huge is 20pt on 25pt isn't that a resonable default? Commented Jan 4, 2020 at 21:25

You must log in to answer this question.

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