12

I need to eliminate the dots that appear in \listoffigures and \listoftables results - is there an easy way to do that?

EDIT:

I think I need to actually eliminate the dots. Modifying @dotsep via

\begin{document}
\renewcommand{\@dotsep}{10000}
...

does not appear to rectify the problem with revtex - I still get

! Illegal unit of measure (mu inserted)

for each figure, which ends up placing a whole bunch of ptmu's where the dots would normally appear.

sample:

\documentclass[aps,amsmath,amssymb,11pt,nofootinbib]{revtex4-1}
\usepackage{tikz,graphicx,hyperref,slashed,stmaryrd,bbold,eepic,pst-all,pstricks-add,multirow,listings}
\begin{document}
% with or without % \renewcommand{\@dotsep}{10000} % doesn't work
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables
\newpage
%...later, some figures and tables ala:
\section{a section}
\subsection{another section}
\begin{table}[t]
 \caption[ShortCaption]{BlahBlahBlahCaption}
 \begin{center}
 \begin{tabular}{|c|c|c|}\hline
 some & data & here \\ \hline
 \end{tabular}
 \end{center}
 \label{tab_A}
\end{table}
\newpage
\section{yet another section}
\begin{figure}[t]
 \begin{center}
 \includegraphics[width=\textwidth]{a_png.png}
 \caption[Short]{Longer.}
 \label{fig_A}
 \end{center}
\end{figure}
\end{document}
Carl
  • 343
  • 1
    The information about revtex was crutial. You should always clarify in your questions, at least, the document class used. – Gonzalo Medina Dec 06 '11 at 21:59
  • 1
    The revtex4 class doesn't seem to support \listoftables or \listoffigures. Please post a complete minimal version of your code (simply add to the snippet you just posted \begin{document}, \end{document} and how you are producing the lists). – Gonzalo Medina Dec 06 '11 at 22:13

2 Answers2

15

To suppress the leading dots from the LoF and LoT, you can redefine \@dotsep:

\documentclass[aps,amsmath,amssymb,11pt,nofootinbib]{revtex4-1}
\usepackage{tikz,graphicx,slashed,stmaryrd,bbold,eepic,pst-all,pstricks-add,multirow,listings}
\usepackage{hyperref}

\begin{document}

\makeatletter
\renewcommand\@dotsep{10000}
\makeatother

\listoffigures
\listoftables
\tableofcontents

\section{Test Section}

\subsection{Test Subsection}
\begin{table}[!ht]
   \caption[Caption in LoT]{Caption in document}
   \centering
   \begin{tabular}{ccc}
    \hline
     some & data & here \\ 
    \hline
   \end{tabular}
   \label{tab_A}
\end{table}

\section{Another Test Section}

\begin{figure}[t]
  \centering
   \includegraphics[width=\textwidth]{a}
   \caption[Short]{Long}
   \label{fig_A}
 \end{figure}

\end{document}

enter image description here

Some remarks:

  1. As my example shows, the redefinition of \@dotsep produces the expected result. However, changing the order of the lists (using for example \tableofcontents before the other two lists) breaks the ToC; this strange behaviour could be the subject of a new question.

  2. You are loading pstricks, which means that if you use pstricks code you can't compile your document directly with pdflatex; this implies that if you are actually going to use pstricks code, you will have to be really careful with the format of your figures (they will have to be in EPS format).

  3. The class revtex4 seems not to implement \listoffigures or \listoftables, so it makes no much sense to use those command with this class. Using revtex4-1, the lists are supported and the solution redefining \@dotsep works as expected.

The strange behaviour of \tableofcontents was, in fact, a bug; I opened a question: Problem with \tableofcontents in revtex4-1 and mforbes provided a quick fix; here's the fix incorporated to your code:

\documentclass[aps,amsmath,amssymb,11pt,nofootinbib]{revtex4-1}
\usepackage{tikz,graphicx,slashed,stmaryrd,bbold,eepic,pst-all,pstricks-add,multirow,listings}
\usepackage{hyperref}

\begin{document}

\makeatletter
\renewcommand\@dotsep{10000}
\makeatother

\tableofcontents

\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother 

\listoffigures
\listoftables

\section{Test Section}

\subsection{Test Subsection}
\begin{table}[!ht]
   \caption[Caption in LoT]{Caption in document}
   \centering
   \begin{tabular}{ccc}
    \hline
     some & data & here \\ 
    \hline
   \end{tabular}
   \label{tab_A}
\end{table}

\section{Another Test Section}

\begin{figure}[t]
  \centering
   \includegraphics[width=\textwidth]{a}
   \caption[Short]{Long}
   \label{fig_A}
 \end{figure}

\end{document}
Gonzalo Medina
  • 505,128
  • changing @dotsep does not seem to resolve the problem, and tocloft seems to not play nice with other packages - adding those to Q – Carl Dec 06 '11 at 21:59
  • 1
    @Carl: Please be a bit more specific as to why changing \@dotsep (note the presence of the backslash character, \) "does not seem to resolve the problem". E.g., do you get an error message? If so, what's the message? – Mico Dec 06 '11 at 22:04
  • 1
    @Carl: see my updated answer (the last paragraph). – Gonzalo Medina Dec 06 '11 at 22:20
  • messes up the ToC - section title collide with formatting; updating minimal example momentarily – Carl Dec 06 '11 at 22:54
  • @Carl: As I said in my updated answer, revetex4 doesn't support \listoffigures or \listoftables. Do you have to use revtex4 or could you switch to the more modern revtex4-1? – Gonzalo Medina Dec 06 '11 at 23:16
  • ah, sorry - didn't edit that in; yes I did switch. That lead to the ToC issue – Carl Dec 06 '11 at 23:17
  • @Carl: see my updated answer, paying special attention to the remarks. If the order of the lists in not acceptable, then you should answer a fresh new question (and consider this one as solved, accepting it). – Gonzalo Medina Dec 06 '11 at 23:57
  • eh, I'm resigned at the moment re list order. Thanks for all the help! – Carl Dec 07 '11 at 01:24
  • @Carl: now the issue with the order of the lists has been solved; see my updated answer. – Gonzalo Medina Dec 07 '11 at 05:18
  • 1
    Actually, you can compile pstricks with pdflatex. However, you need to include \usepackage[pdf]{pstricks}, and is also good to use \usepackage{auto-pst-pdf}. Also you will need to compile with the --shell-escape option (note that you should use only trusted packages with this option). Hence you should execute pdflatex --shell-escape file.tex (In windows you just need one hyphen -shel-escape). – adn Dec 07 '11 at 05:29
  • wow, nice dedication on the ToC/LoF/LoT ordering issue. Wish I could vote your answer up again! – Carl Dec 07 '11 at 14:10
  • @adn: yes, that's why I wrote "you can't compile[...] directly" ;-) It's really useful that you added the steps needed for the compilation; thank you. – Gonzalo Medina Dec 07 '11 at 16:53
4

This is a similar question to Remove dots & Page numbers from TOC.

The "clean" solution is to use the package tocloft and

\renewcommand{\cftdot}{}

to finally remove the dots. In case you are using KOMA-Script, be aware that tocloft does not obey \chapterheadstartvskip.

Minium example: (does not work with revtex4-1 documentclass)

\documentclass{article} 
\usepackage[ngerman]{babel}
\usepackage{tocloft}
\renewcommand{\cftdot}{} 
\begin{document} 
\listoffigures
\listoftables 
\tableofcontents 
\begin{table}
My table
\caption{My table}
\end{table}
\end{document}

(see also https://tex.stackexchange.com/a/55466/9075)

koppor
  • 3,252
  • I really overlooked that the question was intented for revtex4-1 only. I updated my answer accordingly to support others falling in the same trap. – koppor May 15 '12 at 01:04