Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the \iteminput macro from the solution at How to adjust macro to respect current \linewidth? to import content from other TeX files. However, this appears to be effecting the indentation of text from \intertext{}. The red text below is where the problem is.

When using the normal \input things work great and the text is left aligned as desired, as shown in (a). However, when using the \iteminput macro the \intertext is shifted to the right, as shown in (b):

enter image description here

I found out that if I remove the \vtop{} from the \iteminput macro, I get the desired behavior. But since this is from an egreg solution, I am reluctant to do that without knowing if that will result in some other problem.



\usepackage{xcolor}% to highlight the problem area in the output

    Two well known equations are:
        E & = mc^2 \\
        F &= ma

    \begingroup%           The grouping here is not currently causing a problem.
        \input{#1}%        But do need grouping here (for a unrelated reason).

    \vtop{%  Removing this fixs the problem.
        \hsize=\noexpand\linewidth\hrule height 0pt\kern-\dimexpr#1\relax%

    \item \input{foo}            % This works great
    \item \iteminput[2.5ex]{foo} % This shifts "and" to right!!
share|improve this question
\noexpand\linewidth looks distinctly odd (and wasn't in egreg's version) as \linewidth is not expandable. – David Carlisle Jul 29 '12 at 23:46
@DavidCarlisle: Hmmm....Wonder where that came from? – Peter Grill Jul 30 '12 at 4:36

1 Answer 1

up vote 12 down vote accepted

The problem is that already the initial solution is wrong and in this particular situation it shows. \vtop is not a LaTeX command, so if you use it you need to fully understand what it does and what it doesn't.

The important part is what it doesn't: it doesn't set up a new box-galley that ignores any outer circumstances like being inside an enumerate. So that fact is still visible inside and \intertext therefore assumes it has to indent its text. However the text is already indented for the simple reason that the whole box is. So a quick fix for your particular case only would be

    \vtop{%  Removing this fixs the problem.
        \hsize=\noexpand\linewidth\hrule height 0pt\kern-\dimexpr#1\relax%
       \@totalleftmargin\z@   % cancel any line indentation

But for course this is not right either as we can see from looking at \@arrayparboxrestore to see what LaTeX is really resetting in such a case.

Bottom line, for a general solution, you are much better off to use a minipage environment (which would take care of all this as it is made to work with other LaTeX constructs). Alternatively you really have to work a lot harder to blend your command with the internals of LaTeX.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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