1

I am using a specially formatted thesis format called authesis. It includes many chapters. I want to include only the content of the chapters without the Chapter number or title name in the generated PDF. For ex, if the Chapter number is 'Chapter 1', the title is 'Introduction' and there are many subsections, the content must have only the subsections and their contents. The Chapter number and title must be absent. Is there any way to do this?

  • 1
    try add\makeatletter \let\chapter\@gobble \makeatother as a start. You will need to redefine some counters (\thesection, \thefigure...) and we need example of your code. – touhami Mar 30 '17 at 10:04
4

Here is a version for book (and probably for most other classes having \chapter as structure level, however not for memoir (yet)).

Just saying \let\chapter\@gobble as touhami proposed is not enough (though a good idea!), since \chapter calls \@chapter, which usually has an optional argument)

I rather caught \chapter itself and redefined it slightly (requires the latest xparse release, however)

The counters being in the reset list of chapter are auto-detected and are removed from the list with \counterwithout in a loop done by \loopthroughresetlist.

\documentclass{book}

\usepackage{xparse}


\usepackage{chngcntr}


\makeatletter
\ExplSyntaxOn

\seq_new:N \g_flower_reset_seq 
\NewDocumentCommand{\loopthroughresetlist}{mm}{%
  \seq_gclear:N \g_flower_reset_seq
  \group_begin:
  \cs_if_exist:cT {cl@#1} {%
    \def\@elt##1{%
      \seq_gput_right:Nn \g_flower_reset_seq {##1}
    }
    \use:c{cl@#1}% Fill the list
  }
  \group_end:
  \seq_map_inline:Nn \g_flower_reset_seq  {%
    \use:c{\cs_to_str:N #2}{#1}{##1}
  }
}
\ExplSyntaxOff


\AtBeginDocument{%
  \let\latex@@chapter\chapter
  \RenewDocumentCommand{\chapter}{sO{#3}m}{%
    \IfBooleanTF{#1}{%
      \latex@@chapter*{#3}%
    }{%
      \ifnogobblechapter
      \latex@@chapter[#2]{#3}
      \fi
    }%
  }
}
\makeatother

\newcommand{\counterwithoutwrapper}[2]{%
  \counterwithout{#2}{#1}%
}

\newif\ifnogobblechapter
\nogobblechapterfalse

\usepackage{hyperref}

\begin{document}

\ifnogobblechapter
\else
\loopthroughresetlist{chapter}{\counterwithoutwrapper}
\fi

\tableofcontents

\chapter[Foo entry to ToC]{Foo Chapter}

\section{A subsection of a gobbled chapter}

\begin{figure}
  \caption{A figure caption}
\end{figure}

\chapter{Another chapter}

\begin{figure}
  \caption{Another figure caption}
\end{figure}

Some other content

\end{document}

enter image description here

  • @Sebastiano: Thanks, I've chosen some votes for you ;-) – user31729 Apr 8 '17 at 5:26
  • 1
    :-). When I see your excellent answers and several very good people like you always vote. I'll always thank you for everything you have done and are doing. You are a wonderful person. – Sebastiano Apr 8 '17 at 6:07
  • @Sebastiano: Don't exaggerate ;-) – user31729 Apr 8 '17 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.