为图表列表、报告类别设置悬挂缩进格式(?),以及为前言、章节等设置其他详细格式

为图表列表、报告类别设置悬挂缩进格式(?),以及为前言、章节等设置其他详细格式

我正在使用 Overleaf 中的 pdfLaTeX 编译器创建一个用于报告文档类的模板。模板规范是针对该机构的,因此有很多规范。

最小可重现示例具有完整的样式,因为某些包/命令在单独使用时会发生冲突。

我的问题是:在图表列表中,如何强制缩进/对齐溢出到下一行的图表标题?

更新

我不想使用它,tocloft因为它删除了很多其他格式并且与titletoc必须titlesec使用的包冲突。

我该如何修改

{\let\oldnumberline\numberline %
        \renewcommand{\numberline}{\figurename~\oldnumberline} %
        \listoffigures}

强制在第二行对齐/缩进?

在此处输入图片描述

以下是生成 7 页 PDF 的代码。格式化插入图片列表的序言部分已注释% ================ Need help here I think

%-------------------------------------------------------
% Dummy Chapter 1
\begin{filecontents*}[overwrite]{ChapterA.tex}
\chapter{Introduction}
\lipsum[1]
\section{Section Name}
Here is some text, see Figure \ref{fig:a}.
\begin{figure}
  \centering
  \includegraphics[width = 0.5\textwidth]{example-image-a}
  \caption[And example figure with a shorter description that still spills over onto the next line. How can I fix the indent?]{An example figure with a long description, many more important words here.} 
  \label{fig:a}
\end{figure}
\subsection{Subsection Name}
Here is a subsection, see \cite{einstein1906new}.
\end{filecontents*}

%-------------------------------------------------------
% Dummy Abstract
\begin{filecontents*}[overwrite]{Abstract.tex}
\cleardoublepage
\addcontentsline{toc}{chapter}{Abstract}
\begin{center}
  \fontsize{18pt}{0pt}\selectfont\MakeUppercase{\textbf{abstract}}
\end{center}

\vspace*{24pt}

This is the abstract.
\end{filecontents*}

%-------------------------------------------------------
% Dummy References
\begin{filecontents*}{refs.bib}
@article{einstein1906new,
  title={A new determination of molecular dimensions},
  author={Einstein, Albert},
  journal={Ann. Phys.},
  volume={19},
  pages={289--306},
  year={1906}
}
\end{filecontents*}

%-------------------------------------------------------
% Preamble
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{nameref}
\usepackage{mathtools}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{subcaption}
\usepackage{natbib}
\usepackage{appendix}
\usepackage{lipsum}

% set page & paragraph dimensions
\usepackage[letterpaper, margin=1in]{geometry}
\setlength{\parindent}{0.5in}
\setlength{\parskip}{6pt}

% set font
\usepackage[sfdefault]{carlito}

% set-up frontmatter, mainmatter, backmatter
\makeatletter
\newcommand\frontmatter{
    \cleardoublepage
    \pagenumbering{roman}}
\newcommand\mainmatter{
    \cleardoublepage
    \pagenumbering{arabic}}
\newcommand\backmatter{
    \if@openright
        \cleardoublepage
    \else
        \clearpage
    \fi
}
\makeatother

% format headers
\usepackage{titlesec}

\newcommand{\chapterjustification}{}
\newcommand{\chapterfont}{\normalfont}
\newcommand{\chapterfontsize}{\fontsize{22pt}{0pt}\selectfont}

\titleformat{\chapter}%
    {\chapterjustification\chapterfont\chapterfontsize\bfseries\MakeUppercase}%
    {\thechapter}{0.5in}{}
\titlespacing*{\chapter}{0pt}{80pt}{40pt}

\titleformat{\section}%
    {\normalfont\fontsize{14pt}{0pt}\selectfont\bfseries\MakeUppercase}%
    {\thesection}{0.5in}{}
\titlespacing*{\section}{0pt}{24pt}{12pt}

\titleformat{\subsection}%
    {\normalfont\fontsize{14pt}{0pt}\selectfont\bfseries}%
    {\thesubsection}{0.5in}{}
\titlespacing*{\subsection}{0pt}{18pt}{12pt}

% format table of contents
\usepackage{titletoc}
\contentsmargin{0.2in}

\titlecontents{chapter}[0.5in]{%
    \addvspace{12pt}\bfseries}{%
    \contentslabel{0.5in}\MakeUppercase}{%
    \hspace*{-0.5in}\MakeUppercase}{%
    \titlerule*[0.5pc]{.}\contentspage} % dot density

\titlecontents{section}[1in]{\bfseries}{%
    \contentslabel{0.5in}\MakeUppercase}{%
    \hspace*{-1in}\MakeUppercase}{%
    \titlerule*[0.5pc]{.}\contentspage}
    
\titlecontents{subsection}[1.5in]{\selectfont}{%
    \contentslabel{0.5in}}{%
    \hspace*{-1in}}{%
    \titlerule*[0.5pc]{.}\contentspage}

\newcommand{\insertTOC}{\begingroup
    \cleardoublepage
    \addcontentsline{toc}{chapter}{Contents}
    \renewcommand{\chapterjustification}{\centering}
    \renewcommand{\chapterfontsize}{\fontsize{16pt}{0pt}\selectfont}
    \titlespacing*{\chapter}{0pt}{0pt}{24pt}
    \tableofcontents
    \endgroup}

% format list of figures & list of tables pages
% ================ Need help here I think (below)
\newcommand{\insertLOF}{\begingroup
    \cleardoublepage
    \addcontentsline{toc}{chapter}{List of Figures}
    \renewcommand{\chapterjustification}{\centering}
    \renewcommand{\chapterfontsize}{\fontsize{16pt}{0pt}\selectfont}
    \titlespacing*{\chapter}{0pt}{0pt}{24pt}
    {\let\oldnumberline\numberline %
        \renewcommand{\numberline}{\figurename~\oldnumberline} %
        \listoffigures}
    \endgroup}
% ================ Need help here I think (above)

\newcommand{\insertLOT}{\begingroup
    \cleardoublepage
    \addcontentsline{toc}{chapter}{List of Tables}
    \renewcommand{\chapterjustification}{\centering}
    \renewcommand{\chapterfontsize}{\fontsize{16pt}{0pt}\selectfont}
    \titlespacing*{\chapter}{0pt}{0pt}{24pt}
    {\let\oldnumberline\numberline %
        \renewcommand{\numberline}{\tablename~\oldnumberline} %
        \listoftables}
    \endgroup}

% load hyperref last to minimize conflicts
\usepackage{xcolor}
\usepackage[linktocpage=true]{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue}

%-------------------------------------------------------
\begin{document}

\frontmatter
\include{Abstract}
\insertTOC
\insertLOF
\insertLOT

\mainmatter
\include{ChapterA}

\backmatter
\bibliographystyle{plain}
\bibliography{refs}


\end{document}
%-------------------------------------------------------

答案1

我不太了解你的代码,但是我摆弄了一下代码\insertLOF,并且还使用了该tocloft包来获得更好的 LoF。

% format list of figures & list of tables pages
% ================ Need help here I think (below)
\newcommand{\insertLOF}{\begingroup
    \cleardoublepage
    \addcontentsline{toc}{chapter}{List of Figures}
    \renewcommand{\chapterjustification}{\centering}
    \renewcommand{\chapterfontsize}{\fontsize{16pt}{0pt}\selectfont}
    \titlespacing*{\chapter}{0pt}{0pt}{24pt}
    {\let\oldnumberline\numberline %
        \renewcommand{\numberline}{\figurename~\oldnumberline} %
        \listoffigures}
    \endgroup}
% ================ Need help here I think (above)

% and here it is --- Peter W.
\usepackage{tocloft}
\renewcommand{\cftloftitlefont}{\hfill\Large}
\renewcommand{\cftafterloftitle}{\hfill}

\renewcommand{\insertLOF}{%
  \cleardoublepage
  \addcontentsline{toc}{chapter}{List of Figures}
  \listoffigures
}

您应该为 做类似的事情\insertLOT

我觉得您展示的代码过于复杂(详细),但我是个脾气暴躁的老头。为什么不试试类(和memoir的超集),例如,它可以自动将 LoF 和 LoT 标题添加到 ToC?bookreport

相关内容