In the list of tables and figures, how to set the same right margin for all lines of all the items?
As an example, the following MWE:
\documentclass{article}
\newlength{\largNum}
\newlength{\tocRightMargin}
\setlength{\tocRightMargin}{2cm}
\newlength{\tocLeftMarginSecondLineFigure}
\setlength{\tocLeftMarginSecondLineFigure}{6.5em}
\makeatletter
\renewcommand*\l@figure[2]{%
\settowidth{\largNum}{\hss #2}
\ifnum \c@tocdepth >\m@ne%
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@%
\setlength\@tempdima{3.4em}%
\noindent%
\begingroup
\pretolerance=10000
\parindent \z@ \rightskip \tocRightMargin%
\parfillskip -\tocRightMargin%
\leavevmode \normalsize%
\advance\leftskip \tocLeftMarginSecondLineFigure%
\hskip -\leftskip%
{\figurename\mbox{\hspace{4pt}}#1}\nobreak%
\leaders\hbox{$\m@th%
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep%
mu$} \hfil\nobreak\hb@xt@%
\largNum{\hss #2}\par%
\penalty\@highpenalty%
\endgroup
\fi}
\makeatother
\begin{document}
\listoffigures
\begin{figure}
\caption{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque justo justo, porta sagittis feugiat eget}
\end{figure}
\end{document}
Produces:

But I would like to have:


~~~~superfluous. I also would not agree with doing this for your entire document, since it would mean that you need to scan and find the longest caption according to which you're align the dot leaders. Am I right? – Werner Jul 03 '13 at 17:09~~~~in the first place? That's what I meant by saying that it is not entirely clear what you're after. – Werner Jul 03 '13 at 17:20