9

For my thesis, I have to write the table of contents in two different languages.. (don't ask me why...). Is there a way to do it?

  • 1
    Welcome to TeX.sx! Is it the table of contents or the index? Italians often confuse the two. – egreg Feb 13 '13 at 17:53
  • if the answer to @egreg s question is yes, then of course the answer would be a totally different one. – Frank Mittelbach Feb 13 '13 at 18:01
  • Yes, you're right! I'm confusing, sorry... I need a table of contents in two different languages. I edit the question. – Daniele Feb 13 '13 at 18:08
  • You probably should start a new topic with the new question to make the site easier to work with – Boris Feb 13 '13 at 18:38
  • @Daniele Should you translate the titles of chapters and sections? What level of sectioning do you want to be listed? – egreg Feb 13 '13 at 18:46
9

Since you changed the question, here is how to make an additional TOC in a different language.

  1. Look how is \tableofcontents defined in your class. For example, in article.cls it is defined as

    \newcommand\tableofcontents{%
      \section*{\contentsname
        \@mkboth{%
          \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
     \@starttoc{toc}%
     }
    

    So we can define a new table with filename file.tos and define it as

    \makeatletter
    \newcommand\spanishtableofcontents{%
      \selectlanguage{spanish}%
      \section*{\contentsname
        \@mkboth{%
          \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
     \@starttoc{tos}%
      \selectlanguage{english}%
     }
     \makeatother
    
  2. Now just add to your sectioning commands writing to the new table (it is possible to add this to the command itself, but since you need to translate the heading anyway, it might be simpler to do it manually):

    \section{Word}%
    \addcontentsline{tos}{section}{\protect\numberline{\thesection} Palabra}
    

    and similarly for subsections etc.

  • you are the best! It works perfectly! If you write adhoc code, it works for sub and subsub sections,too... However to complete your answer, we can define 3 new commands in the preamble, after Boris' code obviously, in this way: 1) \newcommand\sectionit[1]{\addcontentsline{tos}{section}% {\protect\numberline{\thesection} #1}} 2) \newcommand\subsectionit[1]{\addcontentsline{tos}{subsection}% {\protect\numberline{\thesubsection} #1}} 3) \newcommand\subsubsectionit[1]{\addcontentsline{tos}{subsubsection}% {\protect\numberline{\thesubsubsection} #1}} Thanks a lot! – Daniele Feb 14 '13 at 10:33
7

If you have an index in several languages then you mean that you have different index entries that sort differently. This can be easily achieved, for example with the index package. This package supports the generation of different indexes via the command \newindex and the entries then end up in different files.

Each of those files can then be sorted individually using, say makeindex.

  • Sorry, but I wanted to say table of contents, not index, so I think (how you have said before) it's very different... However I already modified my question. – Daniele Feb 13 '13 at 18:21
  • @Daniele would make more sense to ask a new question as your original also make sense and could help others – Frank Mittelbach Feb 13 '13 at 21:46
3

I would do it in this way using multind package and babel:

\usepackage{multind}
\makeindex{spanish}
\makeindex{english}

...

The word\index{english}{Word}\index{spanish}{Palabra}

...

\selectlanguage{spanish}
\printindex{spanish}
\selectlanguage{english}
\printindex{english}
  • Sorry, but I wanted to say table of contents, not index, so I think it's very different... However I already modified my question. – Daniele Feb 13 '13 at 18:22

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.