独立使用选项构建创建一个额外的空间

独立使用选项构建创建一个额外的空间

我想用standalone包导入一些文件。但是每次我使用\includestandalone带有重新编译此文件的选项的命令时build,导入文件之前都会添加一些额外的空间。

以下是 MWE:

\documentclass{book}
\usepackage[utf8]{inputenc}     % 
\usepackage[T1]{fontenc}        % 
\usepackage{standalone} 

\begin{filecontents}{toto.tex}
\documentclass{standalone} 
\begin{document}
toto
\end{document}
\end{filecontents}

\begin{document}
    When I call the standalone command with the option build there is an extra space in front of the input

    .\includestandalone[mode=build]{./toto}.

    while when I do not use the mode build there is no extra space

    .\includestandalone{./toto}.
\end{document}

我没有发现任何此类问题。是否可以避免?

答案1

standalone.sty 中的一个命令\sa@setquote有许多虚假空格:

\documentclass{book}
\usepackage[utf8]{inputenc}     %
\usepackage[T1]{fontenc}        %
\usepackage{standalone}

\begin{filecontents}{toto.tex}
\documentclass{standalone}
\begin{document}
toto
\end{document}
\end{filecontents}

\makeatletter
\def\sa@setquote{%
    \ifx\sa@build@quote\relax
    \expandafter\ifx\csname sa@convert@quote\endcsname\relax
    \begingroup
    \@tempswafalse
    \expandafter\ifx\csname pdftexbanner\endcsname\relax
        \@tempswatrue
    \else
    \def\MiKTeX{MiKTeX}%<---
    \@onelevel@sanitize\MiKTeX
    \expandafter\def\expandafter\testmiktex\expandafter##\expandafter1\MiKTeX##2\relax{%
            \ifx\empty##2\empty
                \@tempswafalse
            \else
                \@tempswatrue
            \fi
    }%<---
    \expandafter\expandafter
    \expandafter\testmiktex\expandafter\pdftexbanner\MiKTeX\relax\relax
    \fi
    \expandafter
    \endgroup
    \if@tempswa
    \def\sa@build@quote{"}%<---
    \else
    \def\sa@build@quote{'}%<---
    \fi
    \else
    \let\sa@build@quote\sa@convert@quote
    \fi
    \fi
}
\makeatother


\begin{document}
    When I call the standalone command with the option build there is an extra space in front of the input


    .\includestandalone[mode=build]{./toto}.

    while when I do not use the mode build there is no extra space

    .\includestandalone{./toto}.
\end{document}

在此处输入图片描述

相关内容