# \dimexpr replacement/“expansion” without eTeX

I want to use \'{\i} in a bookmark. While it works without problems when eTeX is there, I cannot use e.g. \dimexpr without eTeX. (And the current version of my TeX distribution does not contain eTeX support yet.) Is it possible to "expand" the \doaccenti into a form which TeX understands without eTeX, please?

\documentclass{report}
\usepackage[unicode=true,bookmarks=true]{hyperref}

\makeatletter
\newcommand{\doaccenti}{\8\number\dimexpr0.00390625\dimexpr\number"00EDsp\relax\relax
\expandafter\HyPsd@unichar@second@byte\expandafter{%
\number\numexpr"00ED-256*\number\dimexpr0.00390625\dimexpr\number"00EDsp%
\relax\relax\relax}}
\makeatother

\begin{document}

\section[\texorpdfstring{\'{\i}}{\ifpdfstringunicode{\doaccenti}{i}}]{\'{\i}}

Text.

\end{document}


I'm curious now: which (La)TeX distribution are you using? (in which version and OS)

MacKichan ScientificWorkPlace 5.50 Build 2960 (Windows XP)

But you'd better upgrade you TeX distribution if possible

\section[\texorpdfstring{\'{\i}}{% \ifpdfstringunicode{\string\000\string\355}{i}}]{\'{\i}} works with LaTeX built on "Knuth TeX".

Thus SWP is not LaTeX built on "Knuth TeX", unfortunately (does not compile).

I tried

\documentclass{report}
\usepackage[unicode=true,bookmarks=true]{hyperref}

\def\doaccenti{\80\355}

\begin{document}

\section[\texorpdfstring{\'{\i}}{\ifpdfstringunicode{\doaccenti}{i}}]{\'{\i}}

Text.

\end{document}


(as well as the other approaches), but got a:

! TeX capacity exceeded, sorry [save size=5000].
@if ...1expandafter @gobbletwo string #2endcsname
{let #1#2}
l.1449 \newif\ifcheckat@

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.


:-( What can I do now?

(Sorry for posting as answer & thanks Mr Scharrer! I did not see any "Comment" fields because I was not registered yet. Changed that now.)

OK, I found that even

\documentclass{report}
\usepackage[unicode=true,bookmarks=true]{hyperref}
\begin{document}
\section[\texorpdfstring{i}{i}]{i}
Text.
\end{document}


does not compile, but

Solution:

\documentclass{report}
\usepackage{xcolor}
\pagecolor{white}
\usepackage[unicode=true,bookmarks=true]{hyperref}
\begin{document}

\section[\texorpdfstring{\'{\i}}{\ifpdfstringunicode{\80\355}{i}}]{\'{\i}}

Text.

\end{document}


does function properly!

Nevertheless, while this solved the problem, I would still be curious why the

\usepackage{xcolor}
\pagecolor{white}


is needed?!

-
I'm curious now: which (La)TeX distribution are you using? (in which version and OS) –  Martin Scharrer Jul 24 '11 at 9:39
why can't you simply use \section{\'{\i}} with pdflatex or lualatex? –  Herbert Jul 24 '11 at 9:54
In some older TeX distribution, pdftex didn't support e-TeX extensions and pdfetex existed to that purpose. –  egreg Jul 24 '11 at 10:15
@Stephen: You created accidentally two different unregistered accounts. I merged them together so that you can edit your question again. I also moved your second post into the answer. Please consider registering your account to avoid these things. Thank you. –  Martin Scharrer Jul 24 '11 at 11:13
My best answer to "What can I do now" is: leave SWP and use directly LaTeX. You'll lose a (questionable) wysiwyg interface while getting the last versions of the TeX software without waiting for MacKichan to keep the pace. –  egreg Jul 24 '11 at 13:07

Well, \numexpr and \dimexpr do nothing but origin TeX can do. But you'd better upgrade you TeX distribution if possible.

Anyway:

% \number\dimexpr0.00390625\dimexpr\number"00EDsp\relax\relax
\@tempdima="00EDsp
\@tempdimb=0.00390625\@tempdima
\@tempcntb=\@tempdimb
\number\@tempcntb


and

% \number\numexpr"00ED-256*\number\dimexpr0.00390625\dimexpr\number"00EDsp\relax\relax\relax
\@tempdima="00EDsp
\@tempdimb=0.00390625\@tempdima
\@tempcntb=\@tempdimb
\@tempcnta="00ED
\multiply\@tempcntb by 256
\number\@tempcnta


However, the result of \doaccenti is a constant. You can simply use

\def\doaccenti{\80\355}


to express unicode character í.

-
I'll mark this as accepted answer, although \usepackage{xcolor} \pagecolor{white} is additionally needed, but that seems to be specific to SWP. Thank! –  Stephen Jul 26 '11 at 17:34

If all you need is to write the correct octal strings in the bookmark file, the code

\section[\texorpdfstring{\'{\i}}{%
\ifpdfstringunicode{\string\000\string\355}{i}}]{\'{\i}}


works with LaTeX built on "Knuth TeX".

-