General ⇒ How to add some elements to the contents
How to add some elements to the contents
In my contents appears the abstract, my list of figures and tables, then the introduction and my sections. I need to put a point between the name of my section, lits of figures and tables and the page number, I'm working with document class article.
Also I need tha the captions of my tables in the document appear aligned to left.
Its appears like this
abstract 1
list of figures 2
list of tables 3
1. Introduction 4
2. literature 5
2.1. literature century XX ......... 6
.
.
3. conclusions 30
I nedd like this
abstrarct ................................ 1
list of figures .......................... 2
list of tables ........................... 3
1. introduction ........................ 4
2. literature ............................ 5
2.1 literature century XX ......... 6
.
.
.
3. conclusions ........................ 30
Thanks,
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: How to add some elements to the contents
If someone else know how to make, please tell me.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to add some elements to the contents
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
How to add some elements to the contents
the following code ahows that redefining a single command will produce the desired dotted rule for the sections in the ToC. Regarding your captions issue, the standard behaviour is to place the captions aligned to the left. We will need a more precise description of this problem and maybe a minimal working example showing the undesired behaviour.
Code: Select all
\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\begin{document}
\tableofcontents
\newpage
\section*{Abstract}
\addcontentsline{toc}{section}{Abstract}
\newpage
\listoftables
\addcontentsline{toc}{section}{List of Tables}
\newpage
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\newpage
\section{Introduction}
\section{Literature}
\subsection{Literature century XX}
\begin{table}[!ht]
\centering
\begin{tabular}{cc}\hline
some text & some text \\\hline
\end{tabular}
\caption{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}
\label{tab:test}
\end{table}
\end{document}
How to add some elements to the contents
Thanks again, my first question is now answered, but my problem with the caption still continued, I'm using the ‘hang’ option in the package caption2 to indents the caption text, so it will ‘hang’ under the first line of the text, and when the caption of my table or figure is just a simple line, appears centering, and I need aligned to the left, with the others captions with more than one line there is not problem. The same happend with the figures. I will waiting for your suggestions. The example is
Code: Select all
\documentclass{article}
\usepackage{subfigure}
\usepackage[normal,hang]{caption2}
\renewcommand{\captionlabeldelim}{ -}
\usepackage[titles,subfigure]{tocloft}
%To introduce the word Table and Figure in the list of tables and list of figures
\renewcommand{\cfttabpresnum}{Table }
\renewcommand{\cftfigpresnum}{Figure }
\renewcommand{\cfttabaftersnum}{ - }
\renewcommand{\cftfigaftersnum}{ - }
\renewcommand{\cfttabnumwidth}{4.7em}
\renewcommand{\cftfignumwidth}{4.7em}
\renewcommand{\cfttabindent}{0em}
\renewcommand{\cftfigindent}{0em}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\begin{document}
\tableofcontents
\newpage
\section*{Abstract}
\addcontentsline{toc}{section}{Abstract}
\newpage
\listoftables
\addcontentsline{toc}{section}{List of Tables}
\newpage
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\newpage
\section{Introduction}
\section{Literature}
\subsection{Literature century XX}
\begin{table}[!ht]
\caption{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}
\label{tab:test}
\centering
\begin{tabular}{cc}\hline
some text & some text \\\hline
\end{tabular}
\end{table}
\begin{table}[!ht]
\caption{text text text text text}
\label{tab:test1}
\centering
\begin{tabular}{cccccc}\hline
some text & some text & some text & some text & some text & some text \\ \hline
\end{tabular}
\end{table}
\begin{figure}[!ht]
\centering
%\includegraphics[width=15.0cm,height=9.0cm]{BiplotAMMI2Prod.eps}
\caption{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}
\label{Fig:test}
\end{figure}
\begin{figure}[!ht]
\centering
%\includegraphics[width=15.0cm,height=9.0cm]{BiplotAMMI2Prod.eps}
\caption{text text text text text}
\label{Fig:test1}
\end{figure}
\end{document}
How to add some elements to the contents
caption2 is an obsolete package; you should use caption instead. The following code shows how to achieve what you desire, using the \captionsetup command (refer to the caption package documentation for further information).
Code: Select all
\documentclass{article}
\usepackage{caption}
\captionsetup{format=hang,labelsep=endash,singlelinecheck=false}
\begin{document}
\begin{table}[!ht]
\caption{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}
\label{tab:test}
\centering
\begin{tabular}{cc}\hline
some text & some text \\\hline
\end{tabular}
\end{table}
\begin{table}[!ht]
\caption{text text text text text}
\label{tab:test1}
\centering
\begin{tabular}{cccccc}\hline
some text & some text & some text & some text & some text & some text \\ \hline
\end{tabular}
\end{table}
\begin{figure}[!ht]
\centering
\caption{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}
\label{Fig:test}
\end{figure}
\begin{figure}[!ht]
\centering
\caption{text text text text text}
\label{Fig:test1}
\end{figure}
\end{document}
Re: How to add some elements to the contents

Thanks for the help, its works so good, just a final question, the norms in my university require that the captions of the tables with one line appear aligned to the left, and the captions for the figures with one line appear centering. How can I do this?, the command that you send me modify all the captions of tables and figures.
Thank you so much
How to add some elements to the contents
replace
Code: Select all
\captionsetup{format=hang,labelsep=endash,singlelinecheck=false}
Code: Select all
\captionsetup[figure]{format=hang,labelsep=endash}
\captionsetup[table]{format=hang,labelsep=endash,singlelinecheck=false}
Re: How to add some elements to the contents
Thank you so much four your help, all my questions were solved.
