Re: datatool with siunitx (and numprint)
- From: Joseph Wright <joseph.wright@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Aug 2008 05:33:03 -0700 (PDT)
On Aug 20, 9:49 am, t.m.trzec...@xxxxxxxxx wrote:
Could you reverse that logic and instead have a list of commands that
should not be expanded? One could also prevent expansion manually with
\noexpand or \protect where necessary. Why expanding by default would
be a bad thing?
I've inherited the method used in siunitx from rccol, although I hope
I've improved it a little. If you look at the code (search for
\si@tab@gettok@S, line 2339 in 1.0i) you will see there are a number
of "special case" macros that are swept up unexpanded. I've basically
taken these on trust, so perhaps this caution is not needed.
I've tried a few tests with expanding the contents after removing the
above special cases. A bit of care is needed, as with two passes
things like "{title text}" will need to only be processed once
(otherwise the braces are lost and the "e" is mistaken for an exponent
marker!). That is of course do-able. More problematic is the case in
hand. Try doing \edef or \protected@edef with \DTLround:
\documentclass{article}
\usepackage{datatool}
% Build database.
\DTLnewdb{data}
\DTLnewrow{data}\DTLnewdbentry{data}{value}{66.7012}
\DTLnewrow{data}\DTLnewdbentry{data}{value}{66.0212}
\DTLnewrow{data}\DTLnewdbentry{data}{value}{65.275466666667}
\DTLnewrow{data}\DTLnewdbentry{data}{value}{64.9026}
\DTLnewrow{data}\DTLnewdbentry{data}{value}{44.529733333333}
\begin{document}
\DTLforeach{data}{\value=value}{\DTLround{\value}{\value}{5}\value\\}
\makeatletter
\DTLforeach{data}{\value=value}{\protected@edef\temp{\DTLround{\value}
{\value}{5}\value\\}}
\end{document}
So I'm not sure how I can ensure that the cell contents are fully
expanded in a way that is safe, apart from simply typesetting any
"other" contents and hoping that this works.
I'm reluctant to make a change to the underlying mechanism unless it
helps with the point in hand. Suggestions welcome!
--
Joseph Wright
.
- References:
- datatool with siunitx (and numprint)
- From: Stephan Hennig
- Re: datatool with siunitx (and numprint)
- From: Joseph Wright
- Re: datatool with siunitx (and numprint)
- From: Stephan Hennig
- Re: datatool with siunitx (and numprint)
- From: Joseph Wright
- datatool with siunitx (and numprint)
- Prev by Date: CTAN Update: animate
- Next by Date: Re: About the speed of PGF
- Previous by thread: Re: datatool with siunitx (and numprint)
- Next by thread: Re: datatool with siunitx (and numprint)
- Index(es):
Relevant Pages
|