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.

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.
\size@update ...relax \baselineskip \f@linespread 
                                                  \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.)

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
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
    
Does this apply to \arraystretch as well? –  azetina Aug 27 at 23:39
    
@azetina Yes, applies to any macros used as variables –  Joseph Wright Aug 28 at 5:56
    
@azetina Yes, applies to any macros used as variables –  Joseph Wright Aug 28 at 5:56

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.