Standalone creates an extra space with the option build

I want to import some files with the standalone package. But when I use the \includestandalone command with the option build to recompile this file every time, some extra space are added before the import of my file.

Here is a 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}


One of the commands in standalone.sty, \sa@setquote, has a number of spurious spaces:

\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}


• Do you think that the package will be patch in the future ? If yes, in a close future ? (Thanks anyway) – R. N Apr 12 at 14:25
• Well if you report the problem to the author, I would expect that he corrects it fairly fast. – Ulrike Fischer Apr 12 at 14:27
• OK, this is done. I will see. – R. N Apr 12 at 14:34