3

standalone's manual explains three ways of using the package.

  1. standalone.sty: \usepackage{standalone}: for use with a non-standalone class, setting \standalonefalse;
  2. standalone.cls: \documentclass{standalone}: for use standalone, setting \standalonetrue;
  3. standalone.tex: \input{standalone}: for use with another class standalone, setting \standalonetrue.

However, TeX Live does not include standalone.tex. Thinking this was a packaging issue, I made a copy of the source directory, containing standalone.dtx and standalone.ins, and re-extracted the files.

cp -pr source/latex/standalone ~/
pushd ~/standalone
pdflatex standalone.ins

This produces standalone.tex, along with standalone.cls, standalone.cfg, standalone.sty. However, unlike the other files, standalone.tex is empty.

total 272K
drwxr-xr-x   2 <username> <username> 4.0K Gor   3 16:26 ./
drwx------ 103 <username> <username>  12K Gor   3 16:32 ../
-rw-r--r--   1 <username> <username>  902 Gor   3 16:34 standalone.cfg
-rw-r--r--   1 <username> <username>  27K Gor   3 16:34 standalone.cls
-rw-r--r--   1 <username> <username> 178K Tach 25  2016 standalone.dtx
-rw-r--r--   1 <username> <username>  442 Tach 25  2016 standalone.ins
-rw-r--r--   1 <username> <username> 2.7K Gor   3 16:34 standalone.log
-rw-r--r--   1 <username> <username>  34K Gor   3 16:34 standalone.sty
-rw-r--r--   1 <username> <username>    0 Gor   3 16:34 standalone.tex

Presumably, this is why TeX Live doesn't include the file at all.

Now, docstrip is rather alien territory as far as I'm concerned. However, the .dtx certainly looks as if it includes code for standalone.tex:

% \iffalse
%<*standalone.tex>
% \fi
%
%\iffalse
%<*tex>
% \fi
% \subsection{Simple TeX File}
%
%    \begin{macrocode}
%%\ProvidesFile{standalone.tex}[2010/02/28 v0.4 Provides if-switch to show if file is compiled standalone]%
%    \end{macrocode}
%
% \begin{macro}{\ifstandalone}
% Provides \cs{ifstandalone} switch which is |\iftrue| if the normal |\documentclass|
% was not yet executed (and subsequently redefined to be |\@twoclasseserror|).
%    \begin{macrocode}
\expandafter\ifx\csname ifstandalone\endcsname\relax
\expandafter\newif\csname ifstandalone\endcsname
\expandafter\ifx\csname @twoclasseserror\endcsname\documentclass
\else
  \standalonetrue
\fi
\fi
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</tex>
% \fi
%
% \iffalse
%</standalone.tex>
% \fi
%

How exactly am I meant to produce the standalone.tex file so that I can compile the following to typeset abc (in needlessly circuitous fashion)? (See page 18 of the manual.)

\input{standalone}
\documentclass{article}    
\begin{document}
\ifstandalone
  abc
\fi
\end{document}
5

It's a standard .ins file and has

  \file{standalone.tex}{\from{standalone.dtx}{standalone.tex}}%

which I suspect was intended to be

  \file{standalone.tex}{\from{standalone.dtx}{standalone.tex,tex}}%

With that change

 tex standalone.ins

generates all the files including standalone.tex which then looks like

%%\ProvidesFile{standalone.tex}[2010/02/28 v0.4 Provides if-switch to show if file is compiled standalone]%
\expandafter\ifx\csname ifstandalone\endcsname\relax
\expandafter\newif\csname ifstandalone\endcsname
\expandafter\ifx\csname @twoclasseserror\endcsname\documentclass
\else
  \standalonetrue
\fi
\fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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