# Change \baselinestretch using xparse in TeX Live 2012

Is there a preferred way to change \baselinestretch using the xparse package included in TeX Live 2012? (I believe this is xparse version 3570, dated 2012/04/23.)

If I run latex -output-format pdf document.tex on Mac OS X 10.7.4 to create a PDF from this document—

\documentclass{minimal}
\usepackage{xparse}
\RenewDocumentCommand \baselinestretch {} {1}
\begin{document}
hello, world
\end{document}


—pdfTeX never exits. Interrupting pdfTeX produces this output, which for the most part I do not understand—

! Interruption.
\baselineskip \normalbasel...
l.4 \begin{document}


If I replace \RenewDocumentCommand \baselinestretch {} {1} with \renewcommand{\baselinestretch}{1} to obtain—

\documentclass{minimal}
\usepackage{xparse}
\renewcommand{\baselinestretch}{1}
\begin{document}
hello, world
\end{document}


—then pdfTeX finishes and a PDF is produced. Also, using \RenewDocumentCommand in xparse version 2219 (2011/04/08) seems to behave as expected.

(I understand that \baselinestretch is 1 by default; I am using 1 in the examples for the sake of simplicity.)

-

The \baselinestretch macro is used by LaTeX2e as a variable, not as a 'command'. It is used in places where it needs to expanded by TeX. The xparse functions (\RenewDocumentCommand and so on) produce non-expandable commands, for good reasons, but this is not intended to be used for variables. At the moment, there is no native LaTeX3 interface for setting these variables (indeed, it's not clear at present exactly how these variables should be handled in a systematic way). Thus you should use \newcommand for setting \baselinestrech and similar variables in LaTeX2e.
Will the command \cs_set:Npn do the job? –  Marco Daniel Jul 17 '12 at 18:11
@MarcoDaniel Well yes it will, but that's because \cs_set:Npn is TeX's \def renamed: does not make it good document level syntax. –  Joseph Wright Jul 17 '12 at 18:18