Skip to main content
pretty-printing
Source Link
Mico
  • 552.5k
  • 57
  • 753
  • 1.3k

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I

Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y

I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also

Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is the picture showing my problem and MWE respectively:
  

The picture indicating the problem I am facing

\documentclass[11pt,openany,twoside]{book} \raggedbottom \let\cleardoublepage=\clearpage \usepackage[a4paper]{geometry} \usepackage{parskip} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{xcolor, graphicx} \usepackage[dotinlabels]{titletoc} \usepackage{background} \backgroundsetup{contents={}} \usepackage{helvet} \usepackage{color} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy} \usepackage{booktabs}   \usepackage[noindentafter,calcwidth]{titlesec} \titleformat{\section} {\normalfont\Large\bfseries\color{black}} {\thesection}{1em}{} \titleformat{\subsection} {\normalfont\large\bfseries\color{black}} {\thesubsection}{1em}{} \usepackage{calc,pifont} \usepackage{longtable} \usepackage{multirow} \usepackage{colortbl} \newcommand*\myheaderfooterfont{\normalfont\bfseries}   \makeatletter \renewcommand\@biblabel[1] {\textsuperscript{#1}} \makeatother   \usepackage[nottoc]{tocbibind} \usepackage{verbatim} \usepackage[ragged]{sidecap} \usepackage{caption} \captionsetup[table]{skip=5pt} \usepackage[marginal]{footmisc} \renewcommand\footnoterule{\vspace*{-3pt}% \hrule width 2in height 1.4pt \vspace*{2.6pt}} \setlength\footnotemargin{10pt}   \usepackage{tocloft} \renewcommand{\cfttoctitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftloftitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftlottitlefont}{\hfill\normalfont\bfseries\huge} \setlength{\cftbeforetoctitleskip}{-.3cm} \setlength{\cftbeforeloftitleskip}{-.3cm} \setlength{\cftbeforelottitleskip}{-.3cm} \setlength{\cftafterloftitleskip}{1.7cm} \setlength{\cftaftertoctitleskip}{1.4cm} \setlength{\cftafterlottitleskip}{1.7cm} \renewcommand{\cftchapfont}{\normalfont\bfseries} \renewcommand{\cftsecfont}{\normalfont} \renewcommand{\cftsubsecfont}{\normalfont}   \usepackage{etoolbox} \usepackage{regexpatch} \usepackage{listings} \usepackage{float} \captionsetup[table]{labelsep=period,indention=45pt,justification=raggedright} \makeatletter \pretocmd{\chapter}{\addtocontents{toc}{\protect\addvspace{-4\p@}}}{}{} \makeatother \renewcommand\cftchapafterpnum{\vskip-4pt} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, } \usepackage[toc,header]{appendix}   \begin{document}  \frontmatter \frontmatter  { \hypersetup{linkcolor=black} \sffamily\tableofcontents } \titlecontents{chapter} [6pc] {\addvspace{1pc}\normalfont\bfseries \filright} {\contentslabel [\chaptername \thecontentslabel]{6pc}} {}{\hfill\contentspage} [\addvspace{2pt}]   \mainmatter \chapter{XYZ} rhrrgrrgryryryfyfyfr \chapter{ABC} dgdegegegegeggdddrr \backmatter %\makeatletter %\@mainmattertrue %\makeatother \begin{appendices} \addtocontents{toc}{\protect\renewcommand{\protect\cftchappresnum}{Appendix }} \renewcommand{\chaptername}{Appendix} \chapter{Derivation of X} The contents... \chapter{Derivation of Y} \end{appendices}   %\appendix   %\newappendix\label{firstappendix}   %\section{First section}   %This is Appendix~\ref{firstappendix}   %\newappendix\label{secondappendix}    %\section{Another section}   %This is Appendix~\ref{secondappendix} \end{document} 

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is the picture showing my problem and MWE respectively:
 The picture indicating the problem I am facing

\documentclass[11pt,openany,twoside]{book} \raggedbottom \let\cleardoublepage=\clearpage \usepackage[a4paper]{geometry} \usepackage{parskip} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{xcolor, graphicx} \usepackage[dotinlabels]{titletoc} \usepackage{background} \backgroundsetup{contents={}} \usepackage{helvet} \usepackage{color} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy} \usepackage{booktabs} \usepackage[noindentafter,calcwidth]{titlesec} \titleformat{\section} {\normalfont\Large\bfseries\color{black}} {\thesection}{1em}{} \titleformat{\subsection} {\normalfont\large\bfseries\color{black}} {\thesubsection}{1em}{} \usepackage{calc,pifont} \usepackage{longtable} \usepackage{multirow} \usepackage{colortbl} \newcommand*\myheaderfooterfont{\normalfont\bfseries} \makeatletter \renewcommand\@biblabel[1] {\textsuperscript{#1}} \makeatother \usepackage[nottoc]{tocbibind} \usepackage{verbatim} \usepackage[ragged]{sidecap} \usepackage{caption} \captionsetup[table]{skip=5pt} \usepackage[marginal]{footmisc} \renewcommand\footnoterule{\vspace*{-3pt}% \hrule width 2in height 1.4pt \vspace*{2.6pt}} \setlength\footnotemargin{10pt} \usepackage{tocloft} \renewcommand{\cfttoctitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftloftitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftlottitlefont}{\hfill\normalfont\bfseries\huge} \setlength{\cftbeforetoctitleskip}{-.3cm} \setlength{\cftbeforeloftitleskip}{-.3cm} \setlength{\cftbeforelottitleskip}{-.3cm} \setlength{\cftafterloftitleskip}{1.7cm} \setlength{\cftaftertoctitleskip}{1.4cm} \setlength{\cftafterlottitleskip}{1.7cm} \renewcommand{\cftchapfont}{\normalfont\bfseries} \renewcommand{\cftsecfont}{\normalfont} \renewcommand{\cftsubsecfont}{\normalfont} \usepackage{etoolbox} \usepackage{regexpatch} \usepackage{listings} \usepackage{float} \captionsetup[table]{labelsep=period,indention=45pt,justification=raggedright} \makeatletter \pretocmd{\chapter}{\addtocontents{toc}{\protect\addvspace{-4\p@}}}{}{} \makeatother \renewcommand\cftchapafterpnum{\vskip-4pt} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, } \usepackage[toc,header]{appendix} \begin{document}   \frontmatter  { \hypersetup{linkcolor=black} \sffamily\tableofcontents } \titlecontents{chapter} [6pc] {\addvspace{1pc}\normalfont\bfseries \filright} {\contentslabel [\chaptername \thecontentslabel]{6pc}} {}{\hfill\contentspage} [\addvspace{2pt}] \mainmatter \chapter{XYZ} rhrrgrrgryryryfyfyfr \chapter{ABC} dgdegegegegeggdddrr \backmatter %\makeatletter %\@mainmattertrue %\makeatother \begin{appendices} \addtocontents{toc}{\protect\renewcommand{\protect\cftchappresnum}{Appendix }} \renewcommand{\chaptername}{Appendix} \chapter{Derivation of X} The contents... \chapter{Derivation of Y} \end{appendices}   %\appendix   %\newappendix\label{firstappendix}   %\section{First section}   %This is Appendix~\ref{firstappendix}   %\newappendix\label{secondappendix}   %\section{Another section}   %This is Appendix~\ref{secondappendix} \end{document} 

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g

Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y

I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version).

Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is the picture showing my problem and MWE respectively: 

The picture indicating the problem I am facing

\documentclass[11pt,openany,twoside]{book} \raggedbottom \let\cleardoublepage=\clearpage \usepackage[a4paper]{geometry} \usepackage{parskip} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{xcolor, graphicx} \usepackage[dotinlabels]{titletoc} \usepackage{background} \backgroundsetup{contents={}} \usepackage{helvet} \usepackage{color} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy} \usepackage{booktabs}   \usepackage[noindentafter,calcwidth]{titlesec} \titleformat{\section} {\normalfont\Large\bfseries\color{black}} {\thesection}{1em}{} \titleformat{\subsection} {\normalfont\large\bfseries\color{black}} {\thesubsection}{1em}{} \usepackage{calc,pifont} \usepackage{longtable} \usepackage{multirow} \usepackage{colortbl} \newcommand*\myheaderfooterfont{\normalfont\bfseries}   \makeatletter \renewcommand\@biblabel[1] {\textsuperscript{#1}} \makeatother   \usepackage[nottoc]{tocbibind} \usepackage{verbatim} \usepackage[ragged]{sidecap} \usepackage{caption} \captionsetup[table]{skip=5pt} \usepackage[marginal]{footmisc} \renewcommand\footnoterule{\vspace*{-3pt}% \hrule width 2in height 1.4pt \vspace*{2.6pt}} \setlength\footnotemargin{10pt}   \usepackage{tocloft} \renewcommand{\cfttoctitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftloftitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftlottitlefont}{\hfill\normalfont\bfseries\huge} \setlength{\cftbeforetoctitleskip}{-.3cm} \setlength{\cftbeforeloftitleskip}{-.3cm} \setlength{\cftbeforelottitleskip}{-.3cm} \setlength{\cftafterloftitleskip}{1.7cm} \setlength{\cftaftertoctitleskip}{1.4cm} \setlength{\cftafterlottitleskip}{1.7cm} \renewcommand{\cftchapfont}{\normalfont\bfseries} \renewcommand{\cftsecfont}{\normalfont} \renewcommand{\cftsubsecfont}{\normalfont}   \usepackage{etoolbox} \usepackage{regexpatch} \usepackage{listings} \usepackage{float} \captionsetup[table]{labelsep=period,indention=45pt,justification=raggedright} \makeatletter \pretocmd{\chapter}{\addtocontents{toc}{\protect\addvspace{-4\p@}}}{}{} \makeatother \renewcommand\cftchapafterpnum{\vskip-4pt} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, } \usepackage[toc,header]{appendix}   \begin{document} \frontmatter { \hypersetup{linkcolor=black} \sffamily\tableofcontents } \titlecontents{chapter} [6pc] {\addvspace{1pc}\normalfont\bfseries \filright} {\contentslabel [\chaptername \thecontentslabel]{6pc}} {}{\hfill\contentspage} [\addvspace{2pt}]   \mainmatter \chapter{XYZ} rhrrgrrgryryryfyfyfr \chapter{ABC} dgdegegegegeggdddrr \backmatter %\makeatletter %\@mainmattertrue %\makeatother \begin{appendices} \addtocontents{toc}{\protect\renewcommand{\protect\cftchappresnum}{Appendix }} \renewcommand{\chaptername}{Appendix} \chapter{Derivation of X} The contents... \chapter{Derivation of Y} \end{appendices} %\appendix %\newappendix\label{firstappendix} %\section{First section} %This is Appendix~\ref{firstappendix} %\newappendix\label{secondappendix}  %\section{Another section} %This is Appendix~\ref{secondappendix} \end{document} 
added 154 characters in body
Source Link
itc
  • 667
  • 1
  • 6
  • 20

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is the picture showing my problem and MWE respectively:
The picture indicating the problem I am facing

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is my MWE:

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is the picture showing my problem and MWE respectively:
The picture indicating the problem I am facing

Source Link
itc
  • 667
  • 1
  • 6
  • 20

Changing a blank space to Appendix A/B/... in the Table of Contents

I have my appendices in the backmatter and in the table of contents I am getting the appendix title only and I want to have the appendix label before the appendix title e.g
Chapter 1...........XYZ
Chapter 2...........ABC
Appendix A..........Derivation of X
Appendix B..........Derivation of Y
I have tried the solutions provided to this question but none seems to be working for me. I am using Texlive 2022 (up to date) alongside Texstudio (latest version). Also, I want to have a new chapter style for the Appendices only that is different from the rest of the other chapters. Is it possible? Below is my MWE:

\documentclass[11pt,openany,twoside]{book} \raggedbottom \let\cleardoublepage=\clearpage \usepackage[a4paper]{geometry} \usepackage{parskip} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{xcolor, graphicx} \usepackage[dotinlabels]{titletoc} \usepackage{background} \backgroundsetup{contents={}} \usepackage{helvet} \usepackage{color} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy} \usepackage{booktabs} \usepackage[noindentafter,calcwidth]{titlesec} \titleformat{\section} {\normalfont\Large\bfseries\color{black}} {\thesection}{1em}{} \titleformat{\subsection} {\normalfont\large\bfseries\color{black}} {\thesubsection}{1em}{} \usepackage{calc,pifont} \usepackage{longtable} \usepackage{multirow} \usepackage{colortbl} \newcommand*\myheaderfooterfont{\normalfont\bfseries} \makeatletter \renewcommand\@biblabel[1] {\textsuperscript{#1}} \makeatother \usepackage[nottoc]{tocbibind} \usepackage{verbatim} \usepackage[ragged]{sidecap} \usepackage{caption} \captionsetup[table]{skip=5pt} \usepackage[marginal]{footmisc} \renewcommand\footnoterule{\vspace*{-3pt}% \hrule width 2in height 1.4pt \vspace*{2.6pt}} \setlength\footnotemargin{10pt} \usepackage{tocloft} \renewcommand{\cfttoctitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftloftitlefont}{\hfill\normalfont\bfseries\huge} \renewcommand{\cftlottitlefont}{\hfill\normalfont\bfseries\huge} \setlength{\cftbeforetoctitleskip}{-.3cm} \setlength{\cftbeforeloftitleskip}{-.3cm} \setlength{\cftbeforelottitleskip}{-.3cm} \setlength{\cftafterloftitleskip}{1.7cm} \setlength{\cftaftertoctitleskip}{1.4cm} \setlength{\cftafterlottitleskip}{1.7cm} \renewcommand{\cftchapfont}{\normalfont\bfseries} \renewcommand{\cftsecfont}{\normalfont} \renewcommand{\cftsubsecfont}{\normalfont} \usepackage{etoolbox} \usepackage{regexpatch} \usepackage{listings} \usepackage{float} \captionsetup[table]{labelsep=period,indention=45pt,justification=raggedright} \makeatletter \pretocmd{\chapter}{\addtocontents{toc}{\protect\addvspace{-4\p@}}}{}{} \makeatother \renewcommand\cftchapafterpnum{\vskip-4pt} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, } \usepackage[toc,header]{appendix} \begin{document} \frontmatter { \hypersetup{linkcolor=black} \sffamily\tableofcontents } \titlecontents{chapter} [6pc] {\addvspace{1pc}\normalfont\bfseries \filright} {\contentslabel [\chaptername \thecontentslabel]{6pc}} {}{\hfill\contentspage} [\addvspace{2pt}] \mainmatter \chapter{XYZ} rhrrgrrgryryryfyfyfr \chapter{ABC} dgdegegegegeggdddrr \backmatter %\makeatletter %\@mainmattertrue %\makeatother \begin{appendices} \addtocontents{toc}{\protect\renewcommand{\protect\cftchappresnum}{Appendix }} \renewcommand{\chaptername}{Appendix} \chapter{Derivation of X} The contents... \chapter{Derivation of Y} \end{appendices} %\appendix %\newappendix\label{firstappendix} %\section{First section} %This is Appendix~\ref{firstappendix} %\newappendix\label{secondappendix} %\section{Another section} %This is Appendix~\ref{secondappendix} \end{document}