LaTeX change name of \bibliography{} heading (or remove entirely) - latex

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

Related

LaTeX elsarticle style frontmatter

I am experiencing a slight annoyance with LaTeX and Elsevier's elsarticle style.
I cannot get rid of the superscript a in front of the affiliation.
It is needed for multiple authors, so affiliations can be associated with different authors. It is unnecessary in case of a single author.
I could not find a way to remove it.
Is there a way to accomplish this?
This is my LaTeX code.
\documentclass[preprint,12pt,authoryear,nopreprintline]{elsarticle}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\SweaveOpts{concordance=TRUE}
\begin{frontmatter}
\title{Recursive Combinatorial Functions, Matrices,\\ and a Diagram Notation}
\author{Erich Neuwirth}%
\ead{erich.neuwirth#univie.ac.at}%
\affiliation{organisation={University of Vienna, Faculty of Computer Science}}%
\date{\today}
\end{frontmatter}
Some text
\end{document}

Key-value lookup system in Latex macros fails if value has latex tokens

I am trying to use a sort of key-value lookup system in a LaTeX document, but I am having problems when the value itself has LaTeX code within it. In my document, I have the following macro definitions:
\makeatletter
\def\NewLabel#1#2{\expandafter\xdef\csname LBL##1\endcsname{#2}}
\def\Ref#1{\#ifundefined{LBL##1}{???}{\csname LBL##1\endcsname}}
With these macros, I can do the following in my document:
\NewLabel{name1}{John Smith}
\begin{document}
\Ref{name1}
\end{document}
However, the following fails complaining about an extra }:
\usepackage{hyperref}
\NewLabel{name1}{\href{mailto:johnsmith#exmaple.com}{John Smith}}
\begin{document}
\Ref{name1}
\end{document}
I know the solution has to have something to do with \protect or \relax or something like that, but I can't figure out what it is.
Does anyone know the solution to this problem?
I found two solutions to my problem, one using \noexpand and the other changing \xdef to \gdef, though I must admit that I do not fully understand the consequences of my solutions (particularly the use of \gdef). The more narrow solution using \noexpand is:
\documentclass{article}
\makeatletter
\def\NewLabel#1#2{\expandafter\xdef\csname LBL##1\endcsname{#2}}
\def\Ref#1{\#ifundefined{LBL##1}{???}{\csname LBL##1\endcsname}}
\usepackage{hyperref}
\NewLabel{name1}{\noexpand\href{mailto:johnsmith#exmaple.com}{John Smith}}
\begin{document}
\Ref{name1}
\end{document}
The wider solution using \gdef is:
\documentclass{article}
\makeatletter
\def\NewLabel#1#2{\expandafter\gdef\csname LBL##1\endcsname{#2}}
\def\Ref#1{\#ifundefined{LBL##1}{???}{\csname LBL##1\endcsname}}
\usepackage{hyperref}
\NewLabel{name1}{\href{mailto:johnsmith#exmaple.com}{John Smith}}
\begin{document}
\Ref{name1}
\end{document}
Though I see why using \gdef instead of \xdef will avoid expanding the argument, which was previously causing the problem, I am not sure what negative consequences this could have. Is there a context where the change from \xdef to \gdef could cause problems?

Unable to show the glossary with \printglossary in latex

I was given a Latex project as template and I decided to add a glossary on it, however, \printglossary is not working. I can add and use different entries so I guess that the glossary creation is not the problem.
I am using Overleaf and if I try a completely new project with only the glossary (code bellow) \printglossary works fine.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[acronym, toc]{glossaries}
\makeglossaries
\input{Bibliocosas/glossary.tex}
\begin{document}
\tableofcontents
\section{First Section}
The \Gls{latex} typesetting markup language is specially suitable for documents that include \gls{maths}. \Glspl{formula} are rendered properly an easily once one gets used to the commands.
\clearpage
\section{Second Section}
\vspace{5mm}
Given a set of numbers, there are elementary methods to compute its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This process is similar to that used for the \acrfull{lcm}.
\clearpage
\printglossary
\clearpage
\printglossary[type=\acronymtype]
\end{document}
I am using chapters intead of sections in the given project, is that the the cause of the problem?
Using \makenoidxglossaries and \printnoidxglossaries seems to apparently solve the problem.
I thought that I had already tried them but I guess I was wrong. However, I still don't know why the previous code does not work in the given project.
As for me, I had the same issue but I fixed it by using glossaries-extra package after glossaries package using.
\usepackage[automake]{glossaries-extra}
Then clearing the cache.
I had this issue with Overleaf. The problem was that I uploaded the project as a zip and Overleaf created an additional nested directory in the root with the name of my project. Everything worked but not glossaries.
To solve this I just moved all files to the root directory by dragging each of it.

LATEX: delete the number of page from the backmatter

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.

Double-Spacing an ACM Proceedings Article in LaTeX

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.

Resources