Adding bibliography to appendices in latex - latex

I am writing my thesis and I am using the chapterbib option. While it makes beautiful bibliographies for my chapters, I can't get it to do the same thing for my appendices.
The preamble:
\documentclass[pdftex, 11pt, onecolumn, openany]{report}
\usepackage{amsmath}
\usepackage[pdftex]{graphicx}
\usepackage{appendix}
\usepackage[sectionbib]{chapterbib}
\usepackage{chapterbib}
\begin{document}
...
\include{background}
\include{ATRPcomp}
\include{CCTcomp}
\appendix
\include{AppCCT}
\end{document}
In each of my chapter sections and appendix I have:
\chapter{Compartmentalization in Catalytic Chain Transfer}
...
\bibliography{references}
Does the chapterbib also work for appendices or is there another option that could help?

I assume the package to work also within the appendix. I fact, when you issue the command \appendix the sectioning commands' behavior is the same, except for the numbering (and perhaps the heading).
In the main matter, the chapter command
\chapter{CCTcomp}
gives you
7 CCtcomp
(7 is an example). The commands sequence
\appendix
\chapter{AppCCT}
gives you
A AppCCT
The bibliography shoud work properly.

Related

Latex ClassicThesis - The numbering of the paragraphs does not appear

I need one more numbered level for my report. I used \paragraph{title} but it only appears without numbering.
In the config file, the paragraph is described as:
\titleformat{\paragraph}[runin]
{\normalfont\normalsize}{\theparagraph}{0pt}{\spacedlowsmallcaps}
I believe that the command \theparagraph is responsible for the numbering. Why doesn't it appear?
I searched the net for answers and tried the following commands (at once) before the beginning of the document:
\setcounter{secnumdepth}{\paragraphnumdepth}
Replace the previous command to get rid of run-in with:
\titleformat{\paragraph}
{\relax}{\textsc{\MakeTextLowercase{\theparagraph}}}{1em}{\normalsize\itshape}
\renewcommand{\theparagraph}{\thesubsection.\arabic{paragraph}}
I put the last two commands in \makeatletter and \makeatother.
The paragraph name appears like the section names now, but still no numbers. Any ideas? Here is a small example that works because I didn't include the classicthesis config files.
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{\paragraphnumdepth}
\begin{document}
\chapter{Chapitre}
\section{Introduction}
\subsection{Première sous-partie}
\subsubsection{Un cran en dessous}
\paragraph{Paragraphe with number: what I would like in my report}
Functional here because the problem clearly comes from the two classicthesis config files...
\end{document}
Thank you

Temporarily changing document class in LaTeX/resetting pdfLaTeX

How can I temporarily cause pdfLaTeX to forget everything that I've told it and start with a new document class?
I've modified the example environment from the lshort document:
\newwrite\examplesx#out
\newenvironment{examplesx}{%
\begingroup% Lets Keep the Changes Local
\#bsphack
\immediate\openout \examplesx#out \jobname.exa
\let\do\#makeother\dospecials\catcode`\^^M\active
\def\verbatim#processline{%
\immediate\write\examplesx#out{\the\verbatim#line}}%
\verbatim#start
}{%
\immediate\closeout\examplesx#out\#esphack\endgroup%
\noindent\makebox[\textwidth][l]{%
\begin{minipage}[c]{0.45\textwidth}%
\small\verbatiminput{\jobname.exa}
\end{minipage}%
\hspace*{0.1\textwidth}%
\framebox{%
\begin{minipage}{0.45\textwidth}%
\small\input{\jobname.exa}%
\end{minipage}
}%
}\vspace*{\parskip}%
}
and it mostly works, but I want to be able to do something like
\begin{examplesx}
\section{Section}
\end{examplesx}
and have it show up as a section in a box. I also would like it to typeset lists using the standard article style, even if I use it in beamer
I think that the easiest way of doing this is to compile some small document and then include the resultant pdf as an image into the larger document. Much simpler even if not exactly what you want. I have done this to show, in a Beamer presentation, what LaTeX articles look like.
Of course if its a REALLY simple document (e.g., a simple block of text) that you want to have inside beamer, I could recommend that you mimic the document with a TikZ "picture" that contains some text.
Maybe another approach: instead of trying to typeset things in beamer as if they would be done in article, simply typeset them with the article document class and include the result the in the beamer document.
With tcolorbox this can be done automatically:
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{frame}[fragile]
\begin{tcblisting}{
comment only,
pdf comment,
compilable listing,
run pdflatex,
}
\documentclass{article}
\begin{document}
\section{Section Title}
test
\end{document}
\end{tcblisting}
\end{frame}
\end{document}

No page number for divider pages in LaTeX

I have a report in LaTeX, and i have used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \#chap#pppage, issues a \thispagestyle{plain} command, thus overriding your \pagestyle{empty} for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report}
\usepackage{appendix}
%==== The action ================
\makeatletter
\def\#chap#pppage{%
\clear#ppage
\if#twocolumn\onecolumn\#tempswatrue\else\#tempswafalse\fi
\null\vfil
\markboth{}{}%
{ \centering \interlinepenalty \#M
\normalfont \Huge \bfseries \appendixpagename\par}%
\if#dotoc#pp\addappheadtotoc\fi
\vfil\newpage
\if#twoside
\if#openright \null \thispagestyle{empty}\newpage\fi
\fi
\if#tempswa \twocolumn\fi
}
\makeatother
%==== Back to the document ========
\begin{document}
\tableofcontents
\chapter{Blah}
Rhubarb, rhubarb, rhubarb.
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
\chapter{Boff}
Cabbages, cabbages, cabbages.
\end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you
find some pages are numbered anyway,
you are probably encountering one of
the style decisions built into the
standard LaTeX classes: that certain
special pages should always appear
with \pagestyle{plain}, with a page
number at the centre of the page foot.
The special pages in question are
those (in article class) containing a
\maketitle, or (in book and report
classes) \chapter or \part commands.
The simple solution is to reissue the
page style after the command, with
effect for a single page, as, for
example (in article):
\maketitle
\thispagestyle{empty}
So give adding \thispagestyle{empty} after your \appendix a try.
try changing \pagestyle{empty} to \thispagestyle{empty} and put it after \addappheadtotoc.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!

How to explicitly end a \part in LaTeX with hyperref

I have a LaTeX document which contains the following:
\tableofcontents
\chapter{Chapter One}
\part{Part One}
...
\part{Final Part}
\chapter{Final Part Chapters}
\chapter{Chapter not Part of Part}
When I compile this to a PDF with hyperref, the last chapter is included as part of the final part in my bookmarks. (I'm including hyperref as shown below.)
\usepackage[xetex,breaklinks,a4paper]{hyperref}
What I would like to know is how to explicitly end the part before the final chapter, so that hyperref promotes this bookmark to top level when the PDF is created.
Any help would be appreciated.
Heiko Oberdiek's bookmark package (an improvement on his work in hyperref) allows you do to this with its \bookmarksetup command.
\documentclass{book}
\usepackage{bookmark,hyperref}
\begin{document}
\tableofcontents
\chapter{Chapter One}
\part{Part One}
\part{Final Part}
\chapter{Final Part Chapters}
\bookmarksetup{startatroot}% this is it
\addtocontents{toc}{\bigskip}% perhaps as well
\chapter{Chapter not Part of Part}
\end{document}
The \bigskip parts adds a little space in the printed table of contents to visually separate the final chapter from the preceding "part".

How to make 'appendix' appear in toc in Latex?

How to make word 'appendix' appear in the table of contents? Right now toc looks like this:
1 ......
2 ......
.
.
A .....
B .....
I would like it to be:
1 ......
2 ......
.
.
Appendix A .....
Appendix B .....
My latex source file structure is like this:
\begin{document}
\tableofcontents
\include{...}
\include{...}
\appendix
\include{...}
\include{...}
\end{document}
There's a couple of ways to solve this problem; unfortunately, I've only got a hack for you at this stage. One problem is that if we redefine the section number "A" to include the word "Appendix", it messes up the formatting of the table of contents. So instead, I've just defined a new sectioning command that prints the section without a number and inserts "Appendix X" manually.
Kind of ugly, but at least it works without having to change any markup :)
\documentclass{article}
\makeatletter
\newcommand\appendix#section[1]{%
\refstepcounter{section}%
\orig#section*{Appendix \#Alph\c#section: #1}%
\addcontentsline{toc}{section}{Appendix \#Alph\c#section: #1}%
}
\let\orig#section\section
\g#addto#macro\appendix{\let\section\appendix#section}
\makeatother
\begin{document}
\tableofcontents
\section{goo}
\label{a}
This is sec~\ref{a}
\section{har}
\label{b}
This is sec~\ref{b}
\appendix
\section{ji}
\label{c}
This is app~\ref{c}
\subsection{me}
does this look right?
\end{document}
For my thesis, I did the following:
\appendix
\addcontentsline{toc}{section}{Appendix~\ref{app:scripts}: Training Scripts}
\section*{Sample Training Scripts}
\label{app:scripts}
Blah blah appendix content blah blah blah.
Explanation: I manually added a line to the TOC so I would have "Appendix X:..." show up in my TOC. Then I excluded the actual section command from the TOC by using an asterisk.
This is probably most easily achieved by using the appendix
package, or the memoir class.
If you don't want to use a prepackaged solution, you'll have to
hack the sectioning commands. When I needed to do this for my
dissertation, I cloned the report class, and edited until I made
the margins lady happy. What you're looking for is the
definition of the \addcontentsline macro.
The appendix package is really good and simple solution. My answer can be helpful for who wants to change chapters numbering style, for example, with using cyrillic alphabet or roman digits. The appendices numbering style is hardcoded in the \#resets#pp command (I looked in sources here http://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty). I solved it by simple redefining this command to my own. Just add this code into your preamble:
\makeatletter
\renewcommand{\#resets#pp}{\par
\#ppsavesec
\stepcounter{#pps}
\setcounter{section}{0}
\if#chapter#pp
\setcounter{chapter}{0}
\renewcommand\#chapapp{\appendixname}
\gdef\thechapter{\Asbuk{chapter}} % changed
\else
\setcounter{subsection}{0}
\gdef\thechapter{\Asbuk{section}} % changed
\fi
\if#pphyper
\if#chapter#pp
\renewcommand{\theHchapter}{\theH#pps.\Asbuk{chapter}} % changed
\else
\renewcommand{\theHsection}{\theH#pps.\Asbuk{section}} % changed
\fi
\def\Hy#chapapp{\appendixname}%
\fi
\restoreapp
}
\makeatother
As a result,
Appendix A
Appendix B
Appendix C
...
will change to
Appendix A
Appendix Б
Appendix В
... etc
I'm not a latex expert, and I can't guarantee this code won't break something else.
Based on #Will Robertson's answer, the code below defines the same thing but for chapter and also fixes the fact that chapter* does not add to the header when using the fancyhdr package.
With this in the preable all issues are resolved.
\makeatletter
\newcommand\appendix#chapter[1]{%
\refstepcounter{chapter}%
\def\app#ct{Appendix \#Alph\c#chapter: #1}
\orig#chapter*{\app#ct}%
\markboth{\MakeUppercase{\app#ct}}{\MakeUppercase{\app#ct}}
\addcontentsline{toc}{chapter}{\app#ct}%
}
\let\orig#chapter\chapter
\g#addto#macro\appendix{\let\chapter\appendix#chapter}
\makeatother

Resources