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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Child input file

% Child.tex



Main input file

% Main.tex


Main.tex, which is compiled with xelatex.exe, produces the following result. Why is there a white gap on the right side of the imported image?

enter image description here

share|improve this question
up vote 2 down vote accepted

You get a space because of the line break after the \end{document} in the child document. You need to place the usual % there to avoid it. Alternatively using \input{Child}\unskip} should also do it.

share|improve this answer
So should I do it for all cases such as when the child input file just contains equations rather than PSTricks code? – xport Jul 30 '11 at 22:32
It might be a good idea to add \endinput after \end{document} in documents used with standalone. – egreg Jul 30 '11 at 22:33
@egreg: The \end{document} (in sub-files) already contains \endinput (of course! :-) ). I now added \@ignoretrue as well which removes the space. It's funny that the line break is still taken as space even with the \endinput in place. – Martin Scharrer Jul 30 '11 at 22:39
I don't want to create a new question just for asking this: "Is there an option to use in a child input file such that I no longer need to specify \setlength\PreviewBorder{0pt} explicitly in each child input file?" – xport Jul 30 '11 at 22:47
@xport: There is the border class option for the standalone class, e.g. border=0pt. Note that if you \input child documents then the source code is read and preview is not used. – Martin Scharrer Jul 31 '11 at 0:27

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.