2

I'm trying to typeset using UTF8 and use the answers package. However, compilation halts on \begin{sol}, with

 Kapitola 1.
   ! Missing \endcsname inserted.
   <to be read again> 
                \IeC 
   l.20         \begin{sol}

If I switch to utf8x, the compilation halts even sooner on \Newassociation{sol}{Riešenie}{ans}

If I remove the \usepackage{inputenc} line, document compiles, but of course some of my characters will be displayed incorrectly.

This is the code that is causing all the trouble:

\documentclass[12pt]{report}

\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[slovak]{babel}

\usepackage[a4paper]{geometry}
\usepackage[nosolutionfiles]{answers}


\Newassociation{sol}{Riešenie}{ans}
\newtheorem{ex}{Príklad}

\begin{document}
\Opensolutionfile{ans}[ans1]  
\chapter{ľščťžýáí}

\begin{ex}
    Hmm?\\
    \begin{sol}
    Tri.
    \end{sol}
\end{ex}
Naucili sme sa ze odpoved je tri.
\begin{ex}
    1+1?
    \begin{sol}
        Tiez tri.
    \end{sol}
\end{ex}
\Closesolutionfile{ans}
%\section{Solutions}
%\input{ans1}
\end{document}
  • 2
    Welcome to TeX.SX! The second argument to \Newassociation is an environment name, so it can't have accented characters. – egreg Jul 8 '15 at 15:13
2

The command \Newassociation receives three arguments that must be letter only:

After that, there should be several declarations of the form

\Newassociation{xxx}{yyy}{zzz}

where xxx is an environment in the document, and yyy is an environment which will surround the contents of xxx when it is written to symbolic file handle zzz. The names xxx, yyy and zzz should consist of letters only, not numbers, punctuation or spaces.

Here “letters” should be, more precisely, ASCII letters. The second argument is the name of an environment that contains the solutions and can be redefined if so desired, but its name is unimportant, so long as it is a new one. Actually, numbers, punctuation and spaces are allowed; not accented characters, though.

Use \Newassociation{sol}{solution}{ans} and all will go well.

  • 1
    Why not numbers? I could create without problems environments with the names "A3", "A2" (for large pages) as \csname is used internally. – Ulrike Fischer Jul 8 '15 at 15:39
  • @UlrikeFischer Don't ask me: I reported what's in the manual. But I added the remark. – egreg Jul 8 '15 at 15:43

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.