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.

In the siunitx package (v1.3), I know that I can set various options with the \sisetup command. But what if I want a particular option to apply to only a small section of my document, with default behaviors for the rest of the document? How can I "unset" an option I have set and return to defaults?

Here is essentially what I'm trying to do:

Some text with SI units using default options.
\sisetup{prespace}
Some text with SI units using prespace option.
\sisetup{undo prespace, reset to default}
Some more text with SI units using default options.

Is this possible?

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

If the scope of the command is to be limited to a single table environment, say, then issuing the command \sisetup after the \begin{table} statement (but before a \begin{tabular}{...} statement) will automatically achieve your goal.

More generally, you could confine the scope of the \sisetup command by "encasing" it in a pair of \begingroup ... \endgroup commands or, less visually intrusive, with a pair of curly braces -- { and }.

Separately, the current version of the siunitx package is 2.3. If you're still working with version 1.3, as your question seems to indicate, you may want to consider upgrading the package to the latest version. :-)

share|improve this answer
    
All right, that works. It would still be nice if there were a way to reset default options with a command. But the functionality is what I needed. Thanks. –  David Sempsrott Sep 30 '11 at 21:56
    
You may want to take up your issue with Joseph Wright, the author of the siunitx package and very active member (and moderator!) of this StackExchange group. –  Mico Sep 30 '11 at 22:43
add comment

A simple way would be to use {} to make a group which restricts changes to be within that group:

\documentclass{article}
\usepackage{xcolor}
\usepackage{siunitx}

\begin{document}
{\sisetup{color = orange} 
5 \si{m^3}
}

\bigskip
5 \si{m^3}
\end{document}

enter image description here

share|improve this answer
    
Nice example, thanks. –  David Sempsrott Sep 30 '11 at 22:00
add comment

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.