Take the 2-minute tour ×
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.

Child input file

% Child.tex
\documentclass{standalone}
\usepackage{pstricks}
\pagecolor{yellow}

\setlength\PreviewBorder{0pt}

\begin{document}
\begin{pspicture}(4,3)
\psframe[linecolor=red](4,3)
\end{pspicture}%
\end{document}

Main input file

% Main.tex
\documentclass{article}
\usepackage{standalone}
\usepackage{pstricks}
\fboxsep=0pt

\begin{document}
\fbox{\input{Child}}
\end{document}

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

1 Answer 1

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
1  
@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

 
discard

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.