cibercitizen1
unread,Sep 16, 2009, 5:41:26 AM9/16/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to LaTeX Users Group
Vahid, thanks indeed for your help. I wouldn't like
you loose to much time with this.
Following (I don't know how to add attachments)
you can find a simple version of my .tex file.
In POINT-1 I redefine \subsection.
In POINT-2 I let \Question to be \subsection
In POINT-3 I use hyperref
In POINT-4 There is a dummy chapter.
With thinks like that the toc is wrong.
But if I otherwise comment the use of hyperref,
then the toc is OK.
That plus your evidence, implies that the problem
should be my redefinition of subsection (POINT-1)
or a strange interaction of it & hyperref,
since my redefinition is OK without hyperref.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILE : index.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{book}
%----------------------------------------------------------------
% font
%----------------------------------------------------------------
\usepackage{bookman}
%----------------------------------------------------------------
% accents and language
%----------------------------------------------------------------
%\usepackage[spanish]{babel}
%\usepackage[utf8]{inputenc} % iso-8859-1
%----------------------------------------------------------------
% colors
%----------------------------------------------------------------
\usepackage{color}
%----------------------------------------------------------------
% packages that must be include after changing page layout
%----------------------------------------------------------------
%----------------------------------------------------------------
% rich PDF (hyperref)
%----------------------------------------------------------------
%\usepackage{thumb pdf}
% 1$ pdflatex index.tex
% 2$ thumbpdf index.pdf
% 3$ pdflatex index.tex
% POINT-3
\usepackage
[a4paper,ps2pdf,hyperindex,colorlinks,linkcolor=blue,bookmarksnumbered]
{hyperref}
%----------------------------------------------------------------
% colors
%----------------------------------------------------------------
\definecolor{Blue1}{rgb}{0.1, 0.1, 0.5}
\definecolor{Blue2}{rgb}{0.0, 0.0, 0.4}
\definecolor{Blue3}{rgb}{0.0, 0.0, 0.5}
\definecolor{Green1}{rgb}{0.1, 0.5, 0.1}
\definecolor{Green2}{rgb}{0.0, 0.4, 0.0}
\definecolor{Green3}{rgb}{0.0, 0.5, 0.0}
\definecolor{Red1}{rgb}{0.5, 0.1, 0.1}
\definecolor{Red2}{rgb}{0.4, 0.0, 0.0}
\definecolor{Red3}{rgb}{0.5, 0.0, 0.0}
\definecolor{Red4}{rgb}{0.8, 0.1, 0.1}
\definecolor{jDarkRed}{rgb}{0.5,0.0,0.0}
\definecolor{jBrown}{rgb}{0.6,0.4,0.1}
\definecolor{Grey1}{rgb}{0.1,0.1,0.1}
\definecolor{Grey2}{rgb}{0.2,0.2,0.2}
%----------------------------------------------------------------
% commands for sectioning with colors
% (sembla que no es gaste en este faq de programació
%----------------------------------------------------------------
%----------------------------------------------------------------
% POINT-1
%----------------------------------------------------------------
\makeatletter
\renewcommand{\subsection}{%
\@startsection{subsection}% name
{2}% level
{-1cm}% indent
{-\baselineskip}% beforeskip
{2pt}% afterskip
{\normalfont\large\bf}% skip
}
\renewcommand{\section}{%
\newpage%
\@startsection{section}% name
{1}% level
{-1.5cm}% indent
{-\baselineskip}% beforeskip
{1ex}% afterskip
{\normalfont\huge\bf}% skip
}
\makeatother
%----------------------------------------------------------------
% Question & Answer
%----------------------------------------------------------------
% POINT-2
\let\Question\subsection
%----------------------------------------------------------------
\newcommand{\Answer}[1]{\vspace{2em}{\color{Blue3}\subsubsection*
{\hspace{-1cm}#1}}\vspace{-0.5em}}
%----------------------------------------------------------------
% layout of paragraphs
%----------------------------------------------------------------
\parskip=1ex
\parindent=0pt
\sloppy
%----------------------------------------------------------------
% title
%----------------------------------------------------------------
\title{Programming FAQ}
\author{Me}
\date{\today}
%================================================================
% DOCUMENT STARTS HERE
%================================================================
\begin{document}
%----------------------------------------------------------------
% first page
%----------------------------------------------------------------
\maketitle
%\begin{abstract}
%
%\end{abstract}
%----------------------------------------------------------------
\tableofcontents
%----------------------------------------------------------------
% chapters
%----------------------------------------------------------------
% POINT-4
%***********************************************************************
\chapter{Introduction}
%***********************************************************************
\section{Basics}
%==========================================================
\begin{Question}{¿How do I write very long lines that can
be correctly shown in the table of contents}
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
bla, bla, bla, bla, bla, bla, bla
\Answer{In C++}
I don't know right now.
\end{Question}
%==========================================================
%================================================================
\end{document}
%================================================================
%----------------------------------------------------------------
% the file ends here
%----------------------------------------------------------------