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'm trying to find a way to insert some text at the end of the table of contents, without it being written in the shorttoc.

To be precise, my advisor does not want me to write "Written with \LaTeX" on the first page, so I decided to put it at the very end. But now it appears two times : in the shorttoc and in the table of content.

I suppose there's a way to use "addtocontent" to do this, but I don't see how ...

Here's a MWE, and i'm trying to get rid of the first occurence of "Écrit avec Latex" :

\documentclass[a4paper,12pt,oneside]{book} 
\usepackage{shorttoc}
\begin{document}

\shorttableofcontents{LA}{0}


 \chapter{Solala}

 \addtocontents{toc}{ \vfill \protect\begin{flushright}  Document écrit avec \LaTeX.\par \protect\end{flushright}}


\tableofcontents

\end{document}
share|improve this question
3  
Why don't you simply say \tableofcontents\vfill\begin{flushright}...\end{flushright}? –  egreg Jan 30 '13 at 19:01
    
\shorttableofcontents just reads \jobname.toc, so you could use a condition that is switched on/off based on the contents you're using. However, @egreg's proposal seems more fitting (and cleaner). –  Werner Jan 30 '13 at 19:04
    
@Werner That was also my first idea, but then the simpler way presented itself. –  egreg Jan 30 '13 at 19:06
    
This works, but the text is either displayed on another page (if the expression is after \tableofcontent), or displayed on the right page, but still opens a new, empty page ... any idea how to avoid this new page ? –  Thoms Morel Jan 31 '13 at 10:30
add comment

1 Answer

I would definitely go with the proposal made by egreg in comments, but if you absolutely want to play with \addtocontents, here is a way:

\documentclass[a4paper,12pt,oneside]{book} 
\usepackage{shorttoc}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\def\LaTeXstamp{\gdef\LaTeXstamp{\vfill \begin{flushright}  
Document écrit avec \LaTeX.\par \end{flushright}}}

\AtEndDocument{\addtocontents{toc}{\protect\LaTeXstamp}}

\begin{document}

\shorttableofcontents{LA}{0}

\chapter{Solala}

\tableofcontents

\end{document}
share|improve this answer
    
Works great in the MWE. But once I put it in the bigger file, it just does not display anything ... I'll try to find where this fail ... maybe some wrong packages ! –  Thoms Morel Jan 31 '13 at 10:31
    
@ThomsMorel does the .toc file end with a line \LaTeXstamp? (anyway, please consider using egreg's proposal, it is a better way). –  jfbu Jan 31 '13 at 10:36
    
Yes you're right, in my bigger project, the .toc ends with \LaTeXstamp ! So does the mwe.toc. But in the first case, nothing appears on the page ... I'd like to use egreg's proposal, which is simpler, but the new page bothers me, and I dont know how to get rid of it ;-) –  Thoms Morel Jan 31 '13 at 10:43
    
@ThomsMorel .toc ending with \LaTeXstamp is what my proposal does. So, if it does not work, it could be that \shorttableofcontents uses something else than the .toc file, due to some added package. You should check which files are created in the repertory where your .tex file resides. –  jfbu Jan 31 '13 at 10:49
    
I don't really understand ... I'm using the "bredele" class, something made by a french guy for french thesis criting. Works normally well. What I don't get is why, while in both case the .toc file ends with \LaTeXstamp, in the big tex file this does not display the line ... –  Thoms Morel Jan 31 '13 at 10:54
show 1 more comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.