我希望“表格列表”和页码之间的空格用匹配的点填充{\cftdotfill{1.5}}
,并包括定义\makebox[1.9em]
这是怎么做到的?
\begin{tabular*}{\textwidth}{@{}p{.45\textwidth}@{\extracolsep{\fill}}r@{}}
\raggedright
List of Tables & ix
\end{tabular*}
工作示例:
\documentclass[doc,12pt]{apa6}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=apa,backend=biber,language=american]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage[all]{nowidow}
\usepackage[document]{ragged2e}
\usepackage[T1]{fontenc}
\usepackage[tracking=true]{microtype}
\usepackage{amsmath,siunitx,caption}
\usepackage{array}
\usepackage{enumitem}
\usepackage{flafter}
\usepackage{float}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{scrextend}
\usepackage{setspace}
\usepackage{tabu}
\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{threeparttable}
\usepackage{tocloft}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
\usepackage{caption}
\usepackage{collcell}
\usepackage{hhline}
\usepackage{pgf}
\usepackage{underscore}
\doublespacing{}
\raggedbottom{}
\renewcommand{\theadfont}{\normalfont}
\shorttitle{short title}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
% ------------ Header Patches ------------
% source: https://tex.stackexchange.com/questions/125537/how-to-modify-subsubsection-header-apa6-cls?rq=1
\makeatletter
\renewcommand{\section}{\@startsection {section}{1}
{\z@}
{\b@level@one@skip}
{\e@level@one@skip}
{\centering\normalfont\normalsize}}
\renewcommand{\subsection}{\@startsection{subsection}{2}
{\z@}
{\b@level@two@skip}
{\e@level@two@skip}
{\centering\normalfont\normalsize\textbf}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}
{\z@}
{\b@level@three@skip}
{\e@level@three@skip}
{\hspace*{-0.5in}\normalfont\normalsize\textbf}}
\usepackage{etoolbox}
\patchcmd{\paragraph}% <cmd>
{\bfseries\itshape}% <search>
{\bfseries}% <replace>
{}{}% <success><failure>
\setlist [itemize,enumerate]{leftmargin=0.5in,noitemsep, topsep=0pt}
%sets margin for lists, default seems to be 2em (?), removes spaces between listed items
%--------------------------------------- PREFIX TABLE
\newcommand\myleaders{\cftdotfill{1.5}} % same as in TOC!
\def\mypara#1#2{\noindent#1\myleaders\makebox[1.9em][r]{#2}}
%--------------------------------------- End PREFIX TABLE
%----------------------------------------------------------------------
% Begin TOC Format Definitions
%----------------------------------------------------------------------
\addto\captionsenglish{% Replace ”english” with the language you use
\renewcommand{\contentsname}%
{}} %You can leave this empty
\renewcommand\contentsname{\MakeUppercase{Table of Contents}}
\renewcommand\cfttoctitlefont{\hfill\normalfont\mdseries}
\renewcommand\cftsecleader{\cftdotfill{1.5}}
\renewcommand\cftsubsecleader{\cftdotfill{1.5}}
\renewcommand\cftsubsubsecleader{\cftdotfill{1.5}}
%----------------------------------------------------------------------
\renewcommand\cftbeforesecskip{6pt}
\renewcommand\cftbeforesubsecskip{-6pt}
\renewcommand\cftbeforesubsubsecskip{-6pt}
\cftsetindents{section}{0pt}{1em}
\cftsetindents{subsection}{3em}{2em}
\cftsetindents{subsubsection}{6em}{2.5em}
\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}
\setlength{\cftbeforetoctitleskip}{0in}
%------ Hide the LFT and LOT Headers -------------------------------
\addto\captionsenglish{% Replace ”english” with the language you use
\renewcommand{\listfigurename}% turnes default name of
{}} %You can leave this empty
\addto\captionsenglish{% Replace ”english” with the language you use
\renewcommand{\listtablename}%
{}} %You can leave this empty% turnes default name of
%----------------------------------------------------------------------
% END TOC Format Definitions
%----------------------------------------------------------------------
%----------------------------------------------------------------------
% Begin of Table Settings
%----------------------------------------------------------------------
\newcommand{\IE}[1][1]{% indent entry
\hspace{#1em}\ignorespaces}
%----------------------------------------------------------------------
% END of Table Settings
%----------------------------------------------------------------------
%---------------------------------------------------------------
% Turn on the style from the fancyhdr package
\pagestyle{fancy}
% Clear the header and footer
\fancyhead{}
\fancyfoot{}
% Set the position of the footer to be the page number L, C, R
\fancyfoot[C]{\thepage}
%---------------------------------------------------------------
%--Begin tocloft implementation ---------------------------------------
\begin{center}
TABLE OF CONTENTS
\end{center}
\noindent
%--Begin PREFIX implementation ---------------------------------------
\begin{tabular*}{\textwidth}{@{}p{.45\textwidth}@{\extracolsep{\fill}}r@{}}
\raggedright
List of Tables & ix
\end{tabular*}
\mypara{List of Tables}{ix}
\mypara{List of Figures}{ix}
\end{document}
答案1
弄清楚了:
\newcommand\myleaders{\cftdotfill{1.5}}
\def\mypara#1#2{\noindent#1\myleaders\makebox[1.7em][r]{#2}}
\\
!在命令之间有一个空行或会有所不同!
%--Begin PREFIX implementation -------------------------------------
\mypara{List of Tables}{ix} \\
\mypara{List of Figures}{ix} \\
\vspace*{0.7em}
%--End PREFIX implementation ---------------------------------------