General ⇒ Two tables of contents
-
- Posts: 3
- Joined: Wed Feb 09, 2011 2:31 pm
Two tables of contents
I am a PhD student in Spain. I am currently wirting my dissertation in English, but to fulfill regulations about PhD studies at my university, I need to write the table of contents and conclusions in Spanish.
I have read some dissertations which have two tables of contents: one of them in Spanish and the other one in English. I would like to make it like that, but I can't find how.
I have been googling and the most similar I have found is doing it with package tocloft, but I am not sure how to get it done...
Does anybody have any ideas about how to do it?
Thank you very much for your help.
Best regards
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Two tables of contents
-
- Posts: 3
- Joined: Wed Feb 09, 2011 2:31 pm
Two tables of contents
Sorry for not having responded in these few days.
I have a cls file, and then the main document and the chapters of the text inside separated files (which I call with \include)
Here is a MWE of my cls file:
Code: Select all
\ProvidesClass{Classes/PhDthesisTemplate}
%:-------------------------- report or book -----------------------
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\ifx\pdfoutput\undefined
\LoadClass[dvips, a4paper]{book}
\else
%\LoadClass[pdftex, a4paper]{book}
\LoadClass[a4paper]{book}
\fi
%:-------------------------- packages -----------------------
\usepackage{graphics} % for improved inclusion of graphics
\usepackage{lscape}
\usepackage{rotating}
\usepackage{fancyhdr} % for better header layout
\usepackage[Sonny]{fncychap}
\usepackage{eucal}
\usepackage[spanish,english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{eurosym}
\usepackage[usenames, dvipsnames]{color}
\usepackage[perpage]{footmisc}
\usepackage[round,authoryear,sort&compress]{natbib}
\usepackage{ifthen}
\usepackage[nottoc,notlof,notlot]{tocbibind} % correct page numbers for bib in TOC, nottoc suppresses an entry for TOC itself
\usepackage[subfigure,titles]{tocloft}
\usepackage{dsfont}
\usepackage{makerobust}
\usepackage{xspace}
%:-------------------------- Glossary/Abbrev./Symbols -----------------------
\usepackage[intoc]{nomencl} % load nomencl extension; include in TOC
%\nomrefpage % to include page numbers after abbrevations
\renewcommand{\nomname}{Glossary} % rename nomenclature
\renewcommand{\nomlabel}[1]{\textbf{#1}} % make abbreviations bold
\makenomenclature % used to be \makeglossary
%:-------------------------- PDF/PS setup -----------------------
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex, plainpages = false, pdfpagelabels,
pdfpagelayout = SinglePage,
bookmarks = true,
bookmarksopen = true,
bookmarksnumbered = true,
breaklinks = true,
linktocpage = true,
pagebackref = true,
colorlinks = false,
linkcolor = blue,
urlcolor = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures = false
]{hyperref}
\usepackage{url}
\pdfcompresslevel=9
\else
\usepackage[ dvips,
bookmarks,
bookmarksopen = true,
bookmarksnumbered = true,
breaklinks = true,
linktocpage,
pagebackref,
colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures
]{hyperref}
\usepackage{url}
\fi
%SET PAGE LAYOUT HERE
%DEFINE FANCY PAGE LAYOUT OPTIONS
% These macros define an environment for front matter that is always
% single column even in a double-column document.
%:-------------------------- front matter layout -----------------------
% DEDICATION
%...
% ACKNOWLEDGEMENTS
%...
% ABSTRACT
%...
%:-------------------------- page numbers: roman+arabic -----------------------
{\newpage\renewcommand{\thepage}{\arabic{page}}\setcounter{page}{1}}
And here is the main file of my document:
Code: Select all
\documentclass[twoside,11pt]{Classes/PhDthesisTemplate}
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{plain}\cleardoublepage}}
\raggedbottom
%: ----------------------------------------------------------------------
%: TITLE PAGE: name, degree,..
% ----------------------------------------------------------------------
\title{The Title}
% ----------------------------------------------------------------------
% turn of those nasty overfull and underfull hboxes
\hbadness=10000
\hfuzz=50pt
%: --------------------------------------------------------------
%: FRONT MATTER: dedications, abstract,..
% --------------------------------------------------------------
\begin{document}
% sets line spacing
\renewcommand\baselinestretch{1.2}
\baselineskip=18pt plus1pt
%: ----------------------- generate cover page ------------------------
\maketitle % command to print the title page with above variables
%: ----------------------- abstract ------------------------
% Your institution may have specific regulations if you need an abstract and where it is to be placed in the document. The default here is just after title.
\include{abstract/abstract}
%: ----------------------- tie in front matter ------------------------
\frontmatter
\include{front/dedication}
\include{front/acknowledgement}
%: ----------------------- contents ------------------------
\setcounter{secnumdepth}{3} % organisational level that receives a numbers
\setcounter{tocdepth}{3} % print table of contents for level 3
\tableofcontents % print the table of contents
% levels are: 0 - chapter, 1 - section, 2 - subsection, 3 - subsection
%: ----------------------- list of figures/tables ------------------------
\listoffigures % print list of figures
\listoftables % print list of tables
%: --------------------------------------------------------------
%: MAIN DOCUMENT SECTION
% --------------------------------------------------------------
\mainmatter
\include{1.Introduction/Introduction} % background information
\clearemptydoublepage
\include{2.State_of_art/State_of_art} % State of art
% CALL ALL CHAPTERS
% --------------------------------------------------------------
%: BACK MATTER: appendices, refs,..
% --------------------------------------------------------------
%: ----------------------- bibliography ------------------------
\bibliographystyle{Classes/BibStyle}
\bibliography{TheBibliography.bib}
\end{document}
Best regards,
Víctor
Two tables of contents
But the good news is that the document class is already loading the tocloft package, and so it should be possible to use it to create a new table of contents. You could use commands roughly like these... I'm assuming that you only need chapters, sections and subsections in the TOC. If you have subsubsections, etc., then maybe you can figure out what you need to do from here.
Code: Select all
% create a new list
\newlistof{othertoc}{othertoc}{Other Table of Contents}
\setcounter{othertocdepth}{3}
\newlistentry{othertocchapter}{othertoc}{0}
\newlistentry[othertocchapter]{othertocsection}{othertoc}{1}
\newlistentry[othertocsection]{othertocsubsection}{othertoc}{2}
\newcommand{\otherchaptername}[1]{%
\refstepcounter{othertocchapter}%
\addcontentsline{othertoc}{othertocchapter}{{\protect\numberline{\theothertocchapter}#1}}%
}
\newcommand{\othersectionname}[1]{%
\refstepcounter{othertocsection}%
\addcontentsline{othertoc}{othertocsection}{{\protect\numberline{\theothertocsection}#1}}%
}
\newcommand{\othersubsectionname}[1]{%
\refstepcounter{othertocsubsection}%
\addcontentsline{othertoc}{othertocsubsection}{{\protect\numberline{\theothertocsubsection}#1}}%
}
% match chapter entry styles to other toc
\renewcommand{\cftbeforeothertocchapterskip}{\cftbeforechapskip}
\renewcommand{\cftothertocchapterfont}{\cftchapfont}
\renewcommand{\cftothertocchapterpresnum}{\cftchappresnum}
\renewcommand{\cftothertocchapteraftersnum}{\cftchapaftersnum}
\renewcommand{\cftothertocchapteraftersnumb}{\cftchapaftersnumb}
\renewcommand{\cftothertocchapterleader}{\cftchapleader}
\renewcommand{\cftothertocchapterdotsep}{\cftchapdotsep}
\renewcommand{\cftothertocchapterpagefont}{\cftchappagefont}
\renewcommand{\cftothertocchapterafterpnum}{\cftchapafterpnum}
% match section entry styles to other toc
\renewcommand{\cftbeforeothertocsecskip}{\cftbeforesecskip}
\renewcommand{\cftothertocsecfont}{\cftsecfont}
\renewcommand{\cftothertocsecpresnum}{\cftsecpresnum}
\renewcommand{\cftothertocsecaftersnum}{\cftsecaftersnum}
\renewcommand{\cftothertocsecaftersnumb}{\cftsecaftersnumb}
\renewcommand{\cftothertocsecleader}{\cftsecleader}
\renewcommand{\cftothertocsecdotsep}{\cftsecdotsep}
\renewcommand{\cftothertocsecpagefont}{\cftsecpagefont}
\renewcommand{\cftothertocsecafterpnum}{\cftsecafterpnum}
% match subsec entry styles to other toc
\renewcommand{\cftbeforeothertocsubsecskip}{\cftbeforesubsecskip}
\renewcommand{\cftothertocsubsecfont}{\cftsubsecfont}
\renewcommand{\cftothertocsubsecpresnum}{\cftsubsecpresnum}
\renewcommand{\cftothertocsubsecaftersnum}{\cftsubsecaftersnum}
\renewcommand{\cftothertocsubsecaftersnumb}{\cftsubsecaftersnumb}
\renewcommand{\cftothertocsubsecleader}{\cftsubsecleader}
\renewcommand{\cftothertocsubsecdotsep}{\cftsubsecdotsep}
\renewcommand{\cftothertocsubsecpagefont}{\cftsubsecpagefont}
\renewcommand{\cftothertocsubsecafterpnum}{\cftsubsecafterpnum}
Now, whenever you add a new chapter or section or subsection, you need to add its "other name" too:
Code: Select all
\chapter{Name of chapter}%
\otherchaptername{Translation of above}
Code: Select all
\section{Name of section}%
\othersectionname{Translation of section name}
Now, if there's anything else manually added to your table of contents like things having to do with the abstract, dedication, that might get tricky, but since you didn't include that code, I really have no idea how these are handled.
Tweak as need be, and see the tocloft package documentation for guidance.
-
- Posts: 3
- Joined: Wed Feb 09, 2011 2:31 pm
Two tables of contents
Regarding your response, thank you very much for your help, it worked!. I made very slight changes to adapt it completely to my document. I am copying the code with these changes for anybody else who might need it.
Code: Select all
\newcommand{\listothertocname}{New table of contents}
\newlistof{othertoc}{otc}{\listothertocname}
\setcounter{otcdepth}{4}
\newlistentry{othertocchapter}{otc}{0}
\newlistentry[othertocchapter]{othertocsection}{otc}{1}
\newlistentry[othertocsection]{othertocsubsection}{otc}{2}
\newlistentry[othertocsubsection]{othertocsubsubsection}{otc}{3}
\newcommand{\otherchaptername}[1]{%
\refstepcounter{othertocchapter}%
\addcontentsline{otc}{othertocchapter}{{\protect\numberline{\theothertocchapter}#1}}%
}
\newcommand{\othersectionname}[1]{%
\refstepcounter{othertocsection}%
\addcontentsline{otc}{othertocsection}{{\protect\numberline{\theothertocsection}#1}}%
}
\newcommand{\othersubsectionname}[1]{%
\refstepcounter{othertocsubsection}%
\addcontentsline{otc}{othertocsubsection}{{\protect\numberline{\theothertocsubsection}#1}}%
}
\newcommand{\othersubsubsectionname}[1]{%
\refstepcounter{othertocsubsubsection}%
\addcontentsline{otc}{othertocsubsubsection}{{\protect\numberline{\theothertocsubsubsection}#1}}%
}
% match chapter entry styles to other toc
\renewcommand{\cftbeforeothertocchapterskip}{\cftbeforechapskip}
\renewcommand{\cftothertocchapterfont}{\cftchapfont}
\renewcommand{\cftothertocchapterpresnum}{\cftchappresnum}
\renewcommand{\cftothertocchapteraftersnum}{\cftchapaftersnum}
\renewcommand{\cftothertocchapteraftersnumb}{\cftchapaftersnumb}
\renewcommand{\cftothertocchapterleader}{\cftchapleader}
\renewcommand{\cftothertocchapterdotsep}{\cftchapdotsep}
\renewcommand{\cftothertocchapterpagefont}{\cftchappagefont}
\renewcommand{\cftothertocchapterafterpnum}{\cftchapafterpnum}
% match section entry styles to other toc
\renewcommand{\cftbeforeothertocsectionskip}{\cftbeforesecskip}
\renewcommand{\cftothertocsectionfont}{\cftsecfont}
\renewcommand{\cftothertocsectionpresnum}{\cftsecpresnum}
\renewcommand{\cftothertocsectionaftersnum}{\cftsecaftersnum}
\renewcommand{\cftothertocsectionaftersnumb}{\cftsecaftersnumb}
\renewcommand{\cftothertocsectionleader}{\cftsecleader}
\renewcommand{\cftothertocsectiondotsep}{\cftsecdotsep}
\renewcommand{\cftothertocsectionpagefont}{\cftsecpagefont}
\renewcommand{\cftothertocsectionafterpnum}{\cftsecafterpnum}
% match subsec entry styles to other toc
\renewcommand{\cftbeforeothertocsubsectionskip}{\cftbeforesubsecskip}
\renewcommand{\cftothertocsubsectionfont}{\cftsubsecfont}
\renewcommand{\cftothertocsubsectionpresnum}{\cftsubsecpresnum}
\renewcommand{\cftothertocsubsectionaftersnum}{\cftsubsecaftersnum}
\renewcommand{\cftothertocsubsectionaftersnumb}{\cftsubsecaftersnumb}
\renewcommand{\cftothertocsubsectionleader}{\cftsubsecleader}
\renewcommand{\cftothertocsubsectiondotsep}{\cftsubsecdotsep}
\renewcommand{\cftothertocsubsectionpagefont}{\cftsubsecpagefont}
\renewcommand{\cftothertocsubsectionafterpnum}{\cftsubsecafterpnum}
Code: Select all
\listofothertoc
Víctor
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Two tables of contents
Then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting).Vitigcastro wrote:[…] Regarding your response, thank you very much for your help, it worked!. […]
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10