Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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
add comment

migrated from stackoverflow.com Jul 20 '12 at 15:45

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

2 Answers

up vote 1 down vote accepted

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}
share|improve this answer
    
Thanks! Thats works fine. –  Gabriel Jul 20 '12 at 13:56
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.