# Error with struktex making a Case

I am writing a document with TeX using TexLive (Ubuntu), I already installed struktex, it works fine with if and assing, but when i try to make a case statement throw an error.

This is the code:

\documentclass[a4paper,11pt,spanish]{book}

\usepackage{babel}
\usepackage[latin1]{inputenc}

\usepackage[margin=0.75in]{geometry}
\usepackage{courier}
\usepackage{xcolor}
\usepackage{listings}

\usepackage{struktex}

\begin{document}

\begin{struktogramm}(95,30)
\case[10]{4}{3}{Signum(x)}{-1}
\assign{$$a \gets - \frac{1}{x}$$}
\switch{0}
\assign{Output: Division by 0}
\switch{1}
\assign{$$a \gets \frac{1}{x}$$}
\caseend
\end{struktogramm}

\end{document}


And the errors:

./TestCase.tex:23:Argument of \language@active@arg~ has an extra } \switch{0}
./TestCase.tex:23:Paragraph ended before \language@active@arg~ was complete \switch{0}
./TestCase.tex:25:Argument of \language@active@arg~ has an extra } \switch{1}
./TestCase.tex:25:Paragraph ended before \language@active@arg~ was complete \switch{1}

-

## migrated from stackoverflow.comJul 20 '12 at 15:45

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  egreg Jul 20 '12 at 15:55

This problem is mentioned in the manual of Spanish babel
www.tex-tipografia.com/archive/spanish.pdf
Should work with \renewcommand\shorthandsspanish{}

\documentclass[a4paper,11pt,spanish]{book}

\usepackage{babel}
\renewcommand\shorthandsspanish{}

\usepackage[latin1]{inputenc}

\usepackage[margin=0.75in]{geometry}
\usepackage{courier}
\usepackage{xcolor}
\usepackage{listings}

\usepackage{struktex}

\begin{document}

\begin{struktogramm}(95,30)
\case[10]{4}{3}{Signum(x)}{-1}
\assign{$$a \gets - \frac{1}{x}$$}
\switch{0}
\assign{Output: Division by 0}
\switch{1}
\assign{$$a \gets \frac{1}{x}$$}
\caseend
\end{struktogramm}

\end{document}

-
Thanks! Thats works fine. –  Gabriel Jul 20 '12 at 13:56

You can still keep most of the shorthands by passing the es-notilde option to babel:

\documentclass[a4paper,11pt,spanish]{book}

\usepackage[es-notilde]{babel}
\usepackage[latin1]{inputenc}

\usepackage[margin=0.75in]{geometry}
\usepackage{courier}
\usepackage{xcolor}
\usepackage{listings}

\usepackage{struktex}

\begin{document}

\begin{struktogramm}(95,30)
\case[10]{4}{3}{Signum(x)}{-1}
\assign{$$a \gets - \frac{1}{x}$$}
\switch{0}
\assign{Output: Division by 0}
\switch{1}
\assign{$$a \gets \frac{1}{x}$$}
\caseend
\end{struktogramm}

\end{document}


Using the tilde as shorthand for Spanish is deprecated anyway.

Saying \renewcommand\shorthandsspanish{} will disallow all shorthands. This is more conveniently obtained by passing the es-noshorthands option to babel.

-