2

I have an issue using tikzuml and accents. The following works fine:

\usepackage[latin1]{inputenc}
\usepackage[english,frenchb]{babel}
\usepackage{tikz}
\usepackage{tikz-uml}
...
\begin{tikzpicture}
\begin{umlsystem}{e}
\umlusecase{{\'e}}
\end{umlsystem}
\end{tikzpicture}

while the following does not (only the \umlcase line differs):

\usepackage[latin1]{inputenc}
\usepackage[english,frenchb]{babel}
\usepackage{tikz}
\usepackage{tikz-uml}
...
\begin{tikzpicture}
\begin{umlsystem}{{\'e}}
\umlusecase{{\'e}}
\end{umlsystem}
\end{tikzpicture}

I get an error : "Missing \endcsname inserted". So it seems that there is a problem with using accents with the "umlsystem" environment.

Does anyone knows how to fix this issue ?

  • I filed a bug report. – egreg Feb 14 '17 at 21:44
2

The package uses the argument to umlsystm also for forming node names, where accented characters are invalid.

You can patch it (and suggest the authors to do something similar) by storing also a “stringified” version of the argument to be used for node names.

It's easier using regexpatch than xpatch, because the second patch must be applied nine times.

Basically, each of the nine occurrences of \tikzumlSystemName- and the single (\tikzumlSystemName) should be replaced with \tikzumlSystemNameLabel- or (\tikzumlSystemName); the definition of \tikzumlSystemNameLabel is added at the start of the environment: it uses \detokenize to get a string, as opposed to printable characters.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english,frenchb]{babel}
\usepackage{tikz}
\usepackage{tikz-uml}
\usepackage{regexpatch}

\makeatletter
\xpatchcmd{\umlsystem}
  {\def\tikzumlSystemName}
  {\edef\tikzumlSystemNameLabel{\detokenize{#2}}\def\tikzumlSystemName}
  {}{}
\xpatchcmd*{\endumlsystem}
  {\tikzumlSystemName-}
  {\tikzumlSystemNameLabel-}
  {}{}
\xpatchcmd*{\endumlsystem}
  {(\tikzumlSystemName)}
  {(\tikzumlSystemNameLabel)}
  {}{}
\makeatother

\begin{document}
\begin{tikzpicture}
\begin{umlsystem}{{\'e}}
\umlusecase{{\'e}}
\end{umlsystem}
\end{tikzpicture}
\begin{tikzpicture}
\begin{umlsystem}{é}
\umlusecase{é}
\end{umlsystem}
\end{tikzpicture}

\end{document}

You can also use directly the accented characters, as shown in the second example. Here I used utf8, but it works also with latin1.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.