im tring to delete the page number from my \backmatter sequence. I've succeded to do this, writing this code:
\begin{document}
.
.
.
\backmatter
\begingroup
\makeatletter
\let\ps#plain\ps#empty
\addcontentsline{toc}{chapter}{Allegati}
\input{Allegati}
\input{Bibliografia}
\listoffigures
\listoftables
\listof{grafico}{Elenco dei grafici}
\endgroup
\end{document}
But, I don't know why, the last page of my document still have his number. In the code above the last page is a graphic list, but if I change the order of my sequence, for example putting the bibliography in the last position, the this element will present the page number. I'm writing this document using the book class.
Someone can help me?
thanks
As you did not provide a MWE (Minimal Working Example) I can just guess what your document's preamble contains.
Have a look at this code please:
\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{plain}{
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{}
}
\begin{document}
text
\newpage
text
\newpage
\backmatter
\begingroup
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Allegati}
\listoffigures
\listoftables
%\listof{grafico}{Elenco dei grafici}
\endgroup
\end{document}
EDIT1:
This way you redefine the plain-style that is used by every chapter-page in your document.
If you do not want to change it document-wide, your approach is correct; just add a \clearpage before the last \endgroup. It won't create a new page, but delete the pagenumber. Btw, if you don't really need the \begingroup \endgroup leave it out, this will also delete the last page number.
END-EDIT1
A few things to note:
If you use plain book-class, you can use fancyhdr for setting a
page style like in the above example. Later just load the wanted
pagestyle and from there on it will be used.
If you want to write a document according to the modern
standard of LaTeX, maybe think about using a KOMA-class, which
provides great functions for changing the page style (and often they
also work better ;))
For me this MWE does work, having no pagenumber on the last page; if it does not for you, please give us more information about your document.
Related
I have seen this question asked a few times on here but none of the answers have gotten me exactly what I want. I am using Overleaf to write a LaTeX document and when I make a bibliography (using the natbib library) it automatically makes a heading named "References". Can I remove this heading somehow? I've tried a couple other options but they haven't worked. I've attached a minimal working example below:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{hyperref}
\begin{document}
Here is a citation \citep{Source}.
\bibliographystyle{apalike}
\bibliography{refs}
\end{document}
Not sure what didn't work with the existing responses - perhaps you could point to them and indicate what you didn't like about the results? Does replacing the \bibliography{refs} with the following help? (BTW, as this is not an Overleaf question, it's just LaTeX, perhaps remove the overleaf tag and reference.)
\begingroup
\renewcommand
\refname{}
\bibliography{refs}
\endgroup
I would like to create a table of contents for a bachelorthesis but dont wanna nummerate all points of it.
The abstract for example should be in the toc but not with a number.
I write my thesis in the documentclass article where i dont have the chance to use \chapter.
Is there an easy way to fix the problem?
Thank you!
You can use \section*{} which create a section without the numeration.
However, it will not be present in the table of content.
You can manually add it with \addcontentsline{toc}{section}{\protect\numberline{}Your section name}.
For example for an abstract, an introduction, two numbered sections, and a conclusion, you can do:
\documentclass{article}
\begin{document}
\tableofcontents
\section*{Abstract}
\addcontentsline{toc}{section}{\protect\numberline{}Abstract}
\section*{Introduction}
\addcontentsline{toc}{section}{\protect\numberline{}Introduction}
\section{Section 1}
\section{Section 2}
\section*{Conclusion}
\addcontentsline{toc}{section}{\protect\numberline{}Conclusion}
\end{document}
This is a weird question and I don't know if I was able to formulate it that well.
So, I declare a newcommand somewhere like this:
\newcommand{\examplecommand}{\textbf{\textit{exampletext}}}
It'll be used quite many times this way.
I'm trying to also use it in one place in the document, wanting to format it in a different way (with \textsc{}, and none of the bolding and italicization)
I tried doing stuff like
\textsc{\examplecommand}
But that doesn't work, it still somehow prioritizes the formatting in the command declaration.
How can I use the command without changing the declaration, but with different formatting?
EDIT (MWE):
document.tex
--------------------
\documentclass{book}
\usepackage{fancyhdr}
\usepackage{blindtext}
\newcommand{\booktitle}{} % create it empty at first, so that the files can change it
\newcommand{\textbfit}[1]{\textbf{\textit{#1}}} % combine bold and italic in one
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[RO,RE]{\textsc{\booktitle}}
\renewcommand{\headrulewidth}{2pt}
}
\begin{document}
\pagestyle{plain}
\chapter{example1}
\input{doc1}
\chapter{example2}
\input{doc2}
\chapter{example3}
\input{doc3}
\end{document}
doc1.tex
--------------------
\renewcommand{\booktitle}{\textbfit{``Title 1''}}
\booktitle\ is a very nice book, it's really great, buy it etcetcetc
\blindtext
doc2.tex
--------------------
\renewcommand{\booktitle}{\textbfit{``Title 2''}}
\booktitle\ is a very nice book, it's really great, buy it etcetcetc
\blindtext
doc3.tex
--------------------
\renewcommand{\booktitle}{\textbfit{``Title 3''}}
\booktitle\ is a very nice book, it's really great, buy it etcetcetc
\blindtext
The reason I want to be able to do this:
I have 12 documents that I wrote in a single-document form, and now I wish to make them work both in the single-document form (all of them having a separate .tex file that compiles them as a single document), and a form that puts them all into a large file.
I was using that \booktitle command across all of them, since they are all similar in general structure. And now when I wanted to also convert them into book form, I discovered I can use it to change the top right corner text inside the header (see that the definition of the plain fancypagestyle uses that command inside its fancyhead), but, in there, I want to use it with \textsc
The reason I don't want to change my command is because it means changing it across all of the documents inside, and I was just thinking I could do \textsc{\booktitle} and be done with it
You could temporarily switch off your \textbfit command:
\documentclass{book}
\usepackage{fancyhdr}
\usepackage{blindtext}
\newcommand{\booktitle}{} % create it empty at first, so that the files can change it
\newcommand{\textbfit}[1]{\textbf{\textit{#1}}} % combine bold and italic in one
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[RO,RE]{
\begingroup
\let\textbfit\relax
\textsc{\booktitle}
\endgroup
}
\renewcommand{\headrulewidth}{2pt}
}
\begin{document}
\pagestyle{plain}
\chapter{example1}
\renewcommand{\booktitle}{\textbfit{``Title 1''}}
\booktitle\ is a very nice book, it's really great, buy it etcetcetc
\blindtext
\end{document}
I am using the acm LaTeX template and I have trouble making my paper double spaced.
My LaTeX document looks like the following:
\documentclass{acm_proc_article-sp}
\usepackage{setspace}
\doublespacing
\begin{document}
...
\end{document}
When I compile the above document using pdflatex, I get the following error message on the line that I use the command \doublespacing:
Missing number, treated as zero \doublespacing
\linespread{2} should work. Doesn't need any packages, as far as I can tell, and you could change it to 1.9-spacing or 2.1-spacing, if you felt like it...
It looks like the acm_proc_article-sp class does some funky things that confuses the setspace package. In the preamble of your .tex document, add the following lines:
% Redefines \#ptsize to make setspace happy
\makeatletter
\renewcommand{\#ptsize}{0}
\makeatother
% Double-spaces the entire document
\usepackage{setspace}
\doublespacing
I have no idea why the acm_proc_article-sp class redefines \#ptsize to be empty.
I believe you want to use \usepackage{doublespace} to double-space your document. To put in a block of singlespacing, surround it with \begin{singlespace} and \end{singlespace}.
Ref: http://web.mit.edu/olh/Latex/ess-latex.html
The acm_proc_article-sp class seems to redefine \#ptsize to be empty for some reason. I don't know what \#ptsize is used for, so I don't want to mess with it. Using the \show command (see link text for more on this fantastic command), I see that \doublespacing is unpacked into
\setstretch{1.667} \ifcase \#ptsize \relax \setstretch{1.667} \or
\setstretch{1.618} \or \setstretch{1.655}\fi
In other words, \doublespacing is essentially equivalent to \setstretch{1.667}, with slightly different stretch factors if \#ptsize happens to be 1 or 2. So I think the most unobtrusive solution to your problem is replace \doublespacing by \setstretch{1.667}.
\documentclass{acm_proc_article-sp}
\usepackage{setspace}
\setstretch{1.667}
\begin{document}
...
\end{document}
I just tried out this command (in my preamble) for double spacing and it worked fine:
\usepackage{setspace}
\setstretch{2}
Alternative to the accepted solution: you can use \usepackage{setspace} if you include the line \doublespacing within your actual document (I have it right after the \maketitle command), instead of in your preamble. So something like:
\usepackage{fullpage}
\usepackage{setspace}
\begin{document}
\maketitle
\doublespacing
...
\end{document}
I'm not sure why this is different, but I think including it in the actual document automagically fills in the params you're missing.
Though this is an old thread, for those who stumble uppon:
What you have is actually correct and works. The problem is with the template that is being used. Probably it is overriding some command (like the \doublespacing).
This compiles and works fine for me:
\documentclass{article}
\usepackage{setspace}
\doublespacing
\begin{document}
testing
\end{document}
Don't do it. You need to follow the ACM conference proceedings article submission instructions, which don't want you to double-space the article anyway.
I have a section followed by a table of contents like so:
\section{Section1}
ABC.
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents
\newpage
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\newpage
\section{Section2}
DEF.
\section{Section3}
GHI.
My issue is that the "Table of Contents" and "List of Figures" entries in the table of contents link (in the generated pdf) to the wrong place in the file. They both link to the first section section on page 1. The entry in the table is correct (TOC says page 2 and LOF says page 3), but the link goes to the wrong place.
You'll need to use the \phantomsection command:
\section{Section1}
ABC.
\phantomsection
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents
\newpage
\phantomsection
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\newpage
\section{Section2}
DEF.
\section{Section3}
GHI.
See the hyperref manual.
If you're doing this for the bibliography, list of tables or list of figures,
\usepackage[nottoc]{tocbibind}
should fix it, without the wrong-page problems. Otherwise, I havent come across a better solution than \phantomsection with \addcontentsline.
This behavior is due to the fact that \tableofcontents inserts a page break before writing the contents. Hence, your PDF bookmark will point to the page before. Depending on your document class, you can manually insert a number of \newpage commands to keep \tableofcontents from adding another. One or two should be sufficient.
I know, it is a hacky solution, and there might exist a package to solve the problem, but this is how I work around the problem.