samedi 29 novembre 2014

How to get Section without numbers in Title and TOC, but subsections with them


First of all, I have been searching on the web and I have found similar cases but nothing useful for my problem, and more over, I'm pretty new in LaTeX.


The Problem




  • If I take off the numbers from \section, then, numbering of subsections are equal in every section (this is in the Content itself).



    Centered Section Title
    1 Subsection
    1.1 Subsubsection
    1.2 Subsubsection
    Other Section Title
    1 Subsection
    1.1 Subsubsection
    1.2 Subsubsection



  • It is the same in the TOC and additionally, sections are right shifted. Represented with []:



    Index

    Introduction (manually added)......................xx
    [ ]Section Title...................................xx
    [ ]1 Subsection...................................xx
    [ ] 1.1 Subsubsection............................xx
    [ ] 1.2 Subsubsection............................xx
    [ ]Other Section Title.............................xx
    [ ]1 Subsection...................................xx
    [ ] 1.1 Subsubsection............................xx
    [ ] 1.2 Subsubsection............................xx
    Bibliography (manually added)......................xx



What I want




  • I need to get sections without numbers neither in the title nor in the TOC, but \subsection and \subsubsection must have that numeration.



    Centered Section Title
    1.1 Subsection
    1.1.1 Subsubsection
    1.1.2 Subsubsection
    Other Section Title
    2.1 Subsection
    2.1.1 Subsubsection
    2.1.2 Subsubsection



  • Get aligned sections in TOC.




I'm so sorry if I have miswritten something, English is not my native language


My current code:



\documentclass[12pt]{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[spanish,activeacute]{babel}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{amsmath,amsthm}
\usepackage[left=1.58in,right=0.98in,top=0.5in,bottom=0.5in]{geometry}

%to do not put numbers in sections
\usepackage{titlesec}
\titleformat{\section}{\centering}{\thesection}{0em}{\Large\bfseries}
\renewcommand{\thesection}{}% Remove section references...
\renewcommand{\thesubsection}{\arabic{subsection}}%... from subsections

% to fill TOC with dots
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cfttoctitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill\hfill}%center TOC title

%to replace TOC title
\addto\captionsspanish{
\renewcommand{\contentsname}{Indice General}
}

\setcounter{secnumdepth}{3}

\begin{document}
\tableofcontents

\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}
\paragraph{About:} Some text over here...

\section[First Things]{Capítulo 1: First Things}
\subsection{Algo}
\subsubsection{Algo más}

\section[Title for TOC]{Capítulo 2: Title for section}
\subsection{Algo}
\subsubsection{Algo más}

\section[Again for TOC]{Capítulo 3: Title for Text}

\section[Conclutions]{Conclutions}

\clearpage
\addcontentsline{toc}{section}{Bibliography}
% Bibliography.
\begin{thebibliography}{99}
\bibitem{Someone}
\emph{...}.
\end{thebibliography}
\end{document}




Aucun commentaire:

Enregistrer un commentaire