I am trying to make a template for people I work with, and they want a "List of Objects" in addition to List of Tables and List of Figures. But they want the "List of Objects" to have the exact same formatting as the "List of Figures" (at least in the table-of-contents level, the formatting of the objects themselves within the text is different problem).
I originally was going to use the tocloft
package, but that seems to have all kinds of clashes with the other stuff I am using to typeset the table of contents and LoT/LoF (specifically I am using the titlesec
and titletoc
packages). But after working on this for a while they finally recently told me that they want the "List of Objects" to have the exact same formatting as LoF; which makes it seems like I could do some kind of "define this command to be the same as that existing command" type thing to quickly build everything I need for the LoO. Unfortunately I don't know what those commands are. I'm in the process of digging through tocloft to see what I can pull out. Since that package is geared toward making very customizable "List of" options, the code has way more than I need, which makes it a bit difficult to use as a template however.
Any suggestions on how to make a new "List of..." that has identical formatting to LoF, but separate commands to add content to the list? Or where I might read into such a thing, easier than digging through the tocloft package?
Edit:: Based on a comment; to clarify I am using the report document class, although I was hoping to avoid other packages if I can, just because I've already used some to tweak the typesetting of the ToC, LoT, and LoF, and the various packages that deal with these things seem to not play well together.
Edit 2:: I pulled out the relevant code from my cls and put it into a MWE of sorts. It's kind of long because I kept everything in it that manipulates the current ToC/LoT/LoF since part of the problem is avoiding unexpected reformatting of the typesetting when loading other packages. Here is the MWE (to be clear, I would like to add to this a List of Objects that mimics the LoT/LoF). Code is heavily commented for added clarity as well.
\documentclass{report}
\makeatletter
\usepackage[linktoc=all]{hyperref}% Use this to provide intra-pdf hyperlinking and better toc
\hypersetup{% % Setup the coloring of the links.
% % Currently the only necessary one is "colorlinks=true" and "linkcolor=blue".
colorlinks = true, % Colours links instead of ugly boxes
urlcolor = blue, % Colour for external hyperlinks
linkcolor = blue, % Colour of internal links
citecolor = blue % Colour of citations, could be ``red''
}
\usepackage{etoolbox}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{amsthm,amssymb,amsmath}
\usepackage[format=hang,labelsep=period,justification=raggedright,font=singlespacing,singlelinecheck=false]{caption}
\usepackage{titlesec}% Use this for the actual header styling
\usepackage{titletoc}% Use this to manipulate Table of Contents styling
\usepackage{float}
%\RequirePackage[numbers]{natbib}
\usepackage[
margin=1in,% All 4 margins need to be one inch.
paperheight=11in,% We want 11in tall paper.
paperwidth=8.5in% And 8.5in wide paper.
]{geometry}% Geometry package is the easiest way to deal with margins.
\providecommand{\realSingleSpace}{\setstretch{1}}% They claim they want single-space, but what they actually want is
% "as little white space between letters as is visually acceptable".
%%%%%%%%%%%%%%%%
%%% Margins: %%%
%%%%%%%%%%%%%%%%
%%% They want 1 inch all around margins, which we do with the geometry package.
\usepackage[
margin=1in,% All 4 margins need to be one inch.
paperheight=11in,% We want 11in tall paper.
paperwidth=8.5in% And 8.5in wide paper.
]{geometry}% Geometry package is the easiest way to deal with margins.
%% End Margin Config.
%%%%%%%%%%%%%%%%%%%%%
%%% Font Options: %%%
%%%%%%%%%%%%%%%%%%%%%
\raggedright% They want a ragged right edge.
%% End Font Setting
%%%%%%%%%%%%%%%%%%%%%%
%%% Page Numbering %%%
%%%%%%%%%%%%%%%%%%%%%%
%%% They want the page number in arabic numerals in the bottom middle of each page.
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand\headrulewidth{0pt}
\lhead{}\chead{}\rhead{}
\cfoot{\thepage}
\setlength{\footskip}{0.5in}% They want the page number to be half an inch from the bottom.
% This measurement is actually the distance to the text block;
% So 1in margin - 0.5inch from botton = 0.5in footskip value.
%% End page numbering settings
%%%%%%%%%%%%%%%%%%%%
%%% Font Spacing %%%
%%%%%%%%%%%%%%%%%%%%
\usepackage[nodisplayskipstretch]{setspace}% This will allow us to set spacing in general.
% The optional argument "nodisplayskipstretch" turns off doublespacing
% for math display mode environments.
\usepackage{indentfirst}% This will make sure the first paragraph of every chapter is indented.
\doublespacing% Make everything double spaced by default.
\preto\longtable{\par\realSingleSpace}% Pre-append using longtables to make sure that tables are single spaced.
\preto\itemize{\par\realSingleSpace}% Pre-append singlespace to itemize to account for
% single space bullet point lists.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Formating Design %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%
%%% Caption Configuration TBD
\newcounter{figCount}% This is an internal counter to track how many figures
\setcounter{figCount}{1}% We will start at 1 due to how stepping it works.
\newcommand{\addFigure}[3][\Alph{figCount}]{% Command to manually add a figure
\parbox{#2\textwidth}{\centering #1 \\ \includegraphics[width=#2\textwidth]{#3}}
\stepcounter{figCount}
}
\newenvironment{multiFigure}% Environment that mimicks figure type environment,
% Except it doesn't float around and it resets figCount.
{% Begin Environment Code
\setcounter{figCount}{1}
\minipage\textwidth
}
{% End Environment Code
\endminipage
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Theorem environment definitions %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{theorem}{Theorem}[chapter]
\renewcommand{\thetheorem}{\thechapter-\arabic{theorem}}
\newtheorem{claim}{Claim}[chapter]
\renewcommand{\theclaim}{\thechapter-\arabic{claim}}
\newtheorem{lemma}{Lemma}[chapter]
\renewcommand{\thelemma}{\thechapter-\arabic{lemma}}
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Table Formatting %%%
%%%%%%%%%%%%%%%%%%%%%%%%
%%% They want tables configured a certain way that makes the package "longtables" a more desirable option.
% More specifically, from their website on text-flow:
% Text must be continuous throughout the chapter.
% It is best to place all tables and figures at the end of the appropriate chapter.
% Avoid inserting them into the text of the chapter, unless you are able to do so
% without leaving blank gaps at the bottom of text pages.
%%%%%%%
\RequirePackage{longtable}
\RequirePackage{flafter}% This package stops tables from floating backward up the text. This stops weirdness like tables appearing before the section they are in within the source.
%% End table configure
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Header Formatting %%%
%%%%%%%%%%%%%%%%%%%%%%%%
%% Some headers by default have a huge margin between the top of the chapter text and the top margin,
% which the grad school doesn't like. So we use the titlesec package and the \titleformat command to
% directly access all aspects of chapters and parts to fix spacing, formating, and style.
\titlelabel{\thetitle . \quad}
\newif\ifdocBody
\docBodyfalse% Initially we aren't in the body yet.
%% Define chapter's style based on if we want chapters to auto-upper-case or not.
\titleformat{\chapter}[hang]
{\uppercase}
{}
{0pt}
{\centering\realSingleSpace\ifdocBody CHAPTER \thechapter \\[-5pt] \fi}
[\raggedright\doublespacing]
\titleformat{\part}[hang]
{}
{}
{0pt}
{\centering\realSingleSpace\MakeUppercase}
{\raggedright\doublespacing}
\titlespacing{\part}{0pt}{-0.7in}{0.5\baselineskip}
\titlespacing{\chapter}{0pt}{-0.7in}{0.5\baselineskip}
%%% Setup the formating for the actual section, subsection, and subsubsections in the text. We use the titlesec package here as it allows us to directly access the formating without having to renew the command and deal with all the code happening in the background for things like "table of contents" and pagebreaking.
%\titleformat*{\section}{\bfseries\center}% sections need to be bold and centered.
\setcounter{secnumdepth}{5}
\titleformat{\section}%
{%
\bfseries\center\realSingleSpace% We want \section to be bold (\bfseries), centered (\center),
}% and single spaced (\realSingleSpace)
{%
\thesection% The section number is held in \thesection
}%
{1em}% The space between section number and text is the standard 1em
{}%
\titleformat{\subsection}%
{\bfseries\raggedright\realSingleSpace}%
{\thesubsection}%
{1em}{}%
\titleformat{\subsubsection}
{
\bfseries\filright\realSingleSpace% We want \subsubsection to be bold (\bfseries), left-justified (\filright),
}% and single spaced (\realSingleSpace)
{
\thesubsubsection% The section number is held in \thesubsubsection
}
{1em}% The space between section number and text is the standard 1em
{}
\titlespacing{\section}{0pt}{0pt}{0pt}
\titlespacing{\subsection}{0pt}{10pt}{0pt}
\titlespacing{\subsubsection}{0pt}{10pt}{0pt}
%% End of Header formating
%%%%%%%
%%% Table of Contents, List of Figures, and List of Tables fixes: They wanted hyperlinked dotted lines between the chapter name and the page number. They also want all uppercase "TABLE OF CONTENTS".
%%%%%%%
%% Fix the formatting of the various numbers.
\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}% Change the dot to a hyphen for list of figures.
\renewcommand*{\theequation}{\thechapter-\arabic{equation}}% Change the equation to chapter - equation#
\renewcommand*{\thetable}{\thechapter-\arabic{table}}% Change the dot to a hyphen for list of tables.
%%% Fix the titles of the "List Of ...", complete with adding the page/title at the top where applicable.
\renewcommand*\listfigurename{LIST OF FIGURES
\underline{\smash{Figure}} \hfill \underline{\smash{page}}
\vspace*{-0.7\baselineskip}
}%
\renewcommand*\listtablename{LIST OF TABLES
\underline{\smash{Tables}} \hfill \underline{\smash{page}}
\vspace*{-0.7\baselineskip}
}%
\renewcommand{\contentsname}{TABLE OF CONTENTS
\hspace*{0pt}\hfill \underline{\smash{page}}
\vspace*{-0.7\baselineskip}
}%
\titlecontents{figure}[2em]
{}
{\hspace*{-2em}\hyper@linkstart{link}{\Hy@tocdestname}\hspace*{2em}{\contentslabel{2em}}\hyper@linkend}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*\addvspace{8pt}}
\titlecontents{table}[2em]
{}
{\hspace*{-2em}\hyper@linkstart{link}{\Hy@tocdestname}\hspace*{2em}{\contentslabel{2em}}\hyper@linkend}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*\addvspace{8pt}}
%%%% An attempt to do everything with titlesec and titletoc packages instead of using toclof package, to avoid package clashes.
\contentsmargin{0pt}
%%%%%%%
%%% Below is the formatting for all the Table of Contents hyperlinks, dotted lines, and horizontal alignment.
\titlecontents{part}[0em]
{\mdseries}
{\hyper@linkstart{link}{\Hy@tocdestname}{\contentslabel{2.3em}}\hyper@linkend}
{}
{}
\titlecontents{chapter}[0em]
{}
{\contentslabel{2em}}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*\addvspace{8pt}}
\titlecontents{section}[4.1em]
{}
{\hspace*{-2em}\hyper@linkstart{link}{\Hy@tocdestname}\hspace*{2em}{\contentslabel{2em}}\hyper@linkend}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*}
\titlecontents{subsection}[6.4em]
{}
{\hspace*{-2.3em}\hyper@linkstart{link}{\Hy@tocdestname}\hspace*{2.3em}{\contentslabel{2.3em}}\hyper@linkend}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*}
\titlecontents{subsubsection}[9.4em]
{}
{\hspace*{-3em}\hyper@linkstart{link}{\Hy@tocdestname}\hspace*{3em}{\contentslabel{3em}}\hyper@linkend}
{}
{\hyper@linkstart{link}{\Hy@tocdestname}{\titlerule*[5pt]{.}\thecontentspage}\hyper@linkend \\*}
%\newenvironment{multiFigure}% Environment that mimicks figure type environment,
%% Except it doesn't float around and it resets figCount.
% {% Begin Environment Code
% \setcounter{figCount}{1}
% \minipage\textwidth
% }
% {% End Environment Code
% \endminipage
% }
\begin{document}
tocbasic
package from theKoma-Script
bundle; another, thenewfloat
package.titletoc
.