Generalunformatted counter values

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
uzahnd
Posts: 2
Joined: Thu Oct 31, 2013 5:49 pm

unformatted counter values

Post by uzahnd »

Hy

I have a problem when I try to get a counter value with my new TexLive 2013 installation.

assume the following has been defined:

\newcounter{mycounter}
\setcounter{mycounter}{3}


Up to now, \roman{mycounter} gave me a simple iii;
with TexLive 2013, the output is \textlatin {iii} which is defently more than I need. I use counters to dynamically define variables, and with this new behaviour, I understandably get a "!Missing \endcsname inserted"-warning.

Any suggestions how I can get back the old, unformatted value?

Many thanks in advance,
u.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

uzahnd
Posts: 2
Joined: Thu Oct 31, 2013 5:49 pm

unformatted counter values

Post by uzahnd »

Ok, there's a workaround: use \romannumeral\themycounter, respectively \romannumeral\value{mycounter}. But actually, that's what \roman{mycounter} is supposed to do, isn't it?

cheers,
U
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

unformatted counter values

Post by cgnieder »

uzahnd wrote:with TexLive 2013, the output is \textlatin {iii} which is defently more than I need. I use counters to dynamically define variables, and with this new behaviour, I understandably get a "!Missing \endcsname inserted"-warning.

Any suggestions how I can get back the old, unformatted value?
I don't understand you problem at all... \roman is the same in TeX Live 2013 as it has been the last 20 years.

This works nicely with TeX Live 2013:

Code: Select all

\documentclass{article}
\newcounter{mycounter}
\setcounter{mycounter}{3}
\begin{document}
\roman{mycounter}% works

\expandafter\newcommand\expandafter{\csname foo\roman{mycounter}\endcsname}{test}

\fooiii% has been defined and works, too

\end{document}
Regards
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

unformatted counter values

Post by cgnieder »

BTW: In general it is not safe to use \roman to build command names. The following posts are examples where it caused errors:
Regards
site moderator & package author
Post Reply