BibTex: undefined control sequence. ...author} {\bibnamefont {#ref},\ }\href#noop - latex

I have a problem with BibTex citations.
I use the following setup: Vim + VimTex (latexmk) + revtex4-2 class + custom preamble.
The problem occurs when I try to compile my main file master.tex, in which there is a bibliography forced to one column mode:
\onecolumngrid{
\bibliography{references}}
(Edit: I don't get the error without \onecolumngrid{}).
My references.bib file looks as follows:
#misc{KGOF,
author = {KGOF},
title = {Zadania zawodów {I} stopnia {LV} {Olimpiady} {Fizycznej}},
howpublished = {Dostępne na: \url{http://www.kgof.edu.pl/baza_zadan/files/LV-ID2.pdf} (\today)},
}
#misc{reg,
author = {SciPy},
title = {{Orthogonal} {Distance} {Regression}},
howpublished = {Dostępne na: \url{https://docs.scipy.org/doc/scipy/reference/odr.html} (\today)},
}
The error mentioned in title occurs for each entry in my references:
./master.bbl:56 error: Undefined control sequence. ...uthor} {\bibnamefont {KGOF}},\ }\href#noop
Relevant lines in master.bbl read as:
\bibitem [{\citenamefont {KGOF}()}]{KGOF}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibnamefont {KGOF}},\ }\href#noop {}
{\bibinfo {title} {Zadania zawodów {I} stopnia {LV} {Olimpiady}
{Fizycznej}}},\ \bibinfo {howpublished} {Dostępne na:
\url{http://www.kgof.edu.pl/baza_zadan/files/LV-ID2.pdf}
(\today)}\BibitemShut {NoStop}%
I have no idea how to solve this error, nor what does it really mean. Help, please!
Edit: I provide the minimal code to reproduce the problem:
\documentclass[reprint,aps]{revtex4-2}
\usepackage[T1]{fontenc}
\usepackage{dcolumn}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\begin{document}
\title{Test}
\maketitle
\cite{KGOF} and \cite{reg}
\onecolumngrid{
\bibliography{references}}
\end{document}
Best wishes,
Szymon
PS. The main file master.tex compiles so that I get what I would expect, but I constantly get that compilation error.

The syntax is wrong. \onecolumngrid is a switch and does not take an argument
\documentclass[reprint,aps]{revtex4-2}
\usepackage[T1]{fontenc}
\usepackage{dcolumn}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\begin{document}
\title{Test}
\maketitle
\cite{KGOF} and \cite{reg}
\onecolumngrid
\bibliography{references}
\end{document}

Related

Latex-url link manipulating

I am trying to insert a link like this: https://www.bing.com/search?q=latex%20&qs=n&form=QBRE&=Search%20%7B0%7D%20for%20%7B1%7D&=Search%20work%20for%20%7B0%7D&msbsrank=6_9_File_2&sp=-1&ghc=1&pq=latex%20&sc=9-6&sk=&cvid=9E08663E21964006BFBDECC6DB1F0884 to my document using latex.
I tried this line of code:
\href{https://www.bing.com/search?q=latex%20&qs=n&form=QBRE&=Search%20%7B0%7D%20for%20%7B1%7D&=Search%20work%20for%20%7B0%7D&msbsrank=6_9_File_2&sp=-1&ghc=1&pq=latex%20&sc=9-6&sk=&cvid=9E08663E21964006BFBDECC6DB1F0884}{\textit{\textbf{\underline{Something Linky}}}
And it produced an error.
Any help?
You are missing one closing } at the end:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{https://www.bing.com/search?q=latex%20&qs=n&form=QBRE&=Search%20%7B0%7D%20for%20%7B1%7D&=Search%20work%20for%20%7B0%7D&msbsrank=6_9_File_2&sp=-1&ghc=1&pq=latex%20&sc=9-6&sk=&cvid=9E08663E21964006BFBDECC6DB1F0884}{\textit{\textbf{\underline{Something Linky}}}}
\end{document}

Is there a way to make the a glossary entry clickable?

I'm making a glossary using the package \usepackage{glossaries}. This works fine but I have a slight problem.
I would like to make the word I call from the glossary (with \gls(a_word)) clickable, so the reader is automatically taken to the glossary entry that match the word he clicked on.
So far, I tried to use hyperlinks, without any success, and I couldn't find a similar problem on Internet nor on SO.
I hope you will be able to help me out with this!
Thanks by advance
Edit: Here's the code I'm using
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[nonumberlist,toc,chapter=chapter]{glossaries}
In glossary:
\makeglossaries
\setglossarypreamble{Source is INSEE}
\newglossaryentry{AAV}
{
name=AAV,
description={The description of what AAV is.}
}
In document:
sometextsometext (see \Gls{AAV}). Sometextsometext
If you load the hyperref package, the abbreviation will automatically be clickable:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage[nonumberlist,toc]{glossaries}
\makeglossaries
\setglossarypreamble{Source is INSEE}
\newglossaryentry{AAV}
{
name=AAV,
description={The description of what AAV is.}
}
\begin{document}
sometextsometext (see \Gls{AAV}). Sometextsometext
\printglossaries
\end{document}

Latex Commands with URL

I am having trouble adding a URL to the Linkedin command. I want it to essentially print the Linkedin logo, text that I want to be explicitly seen, and a URL that the user will be redirected to upon clicking it. Below is the current .cls file.
.cls file:
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\usepackage{hyperref}
\newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{#1}}
I tried turning the last line into the following:
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}}{\url{#2}}
However, upon doing so, I get the following errors:
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
! Undefined control sequence.
\hyper#linkurl ...tionraw >>}\relax \Hy#colorlink
\#urlcolor #1\Hy#xspace#en...
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
! Undefined control sequence.
\close#pdflink ->\Hy#endcolorlink
\Hy#VerboseLinkStop \pdfendlink
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
Minimum Reproducible Example:
main.tex:
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[10pt,letterpaper]{altacv}
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm,footskip=2\baselineskip}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[default]{lato}
\usepackage[hidelinks]{hyperref}
\begin{document}
\linkedin{linkedin.com/in/varunjain-me}{www.linkedin.com/in/varunjain-me}
\end{document}
.cls file:
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\#ifl#t#r\fmtversion{2018/04/01}{\UseRawInputEncoding}{}
\ProvidesClass{altacv}[2018/07/27 AltaCV v1.1.4, yet another alternative class for a résumé/curriculum vitae.]
\newif\if#academicons
\DeclareOption{academicons}{\#academiconstrue}
\newif\if#normalphoto
\DeclareOption{normalphoto}{\#normalphototrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\ProcessOptions\relax
\LoadClass{extarticle}
\RequirePackage[margin=2cm]{geometry}
\RequirePackage{fontawesome}
\if#academicons
\ExplSyntaxOn
\msg_redirect_name:nnn { fontspec } { font-not-found } { none }
\ExplSyntaxOff
\RequirePackage{academicons}
\newfontfamily{\AI}{academicons.ttf}
\fi
\RequirePackage{xcolor}
\colorlet{accent}{blue!70!black}
\colorlet{heading}{black}
\colorlet{emphasis}{black}
\colorlet{body}{black!80!white}
\newcommand{\itemmarker}{{\small\textbullet}}
\newcommand{\ratingmarker}{\faCircle}
\RequirePackage{tikz}
\usetikzlibrary{arrows}
\RequirePackage[skins]{tcolorbox}
\RequirePackage{enumitem}
\setlist{leftmargin=*,labelsep=0.5em,nosep,itemsep=0.25\baselineskip,after=\vskip0.25\baselineskip}
\setlist[itemize]{label=\itemmarker}
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{dashrule}
\RequirePackage{multirow,tabularx}
\RequirePackage{changepage}
\setlength{\parindent}{0pt}
\newcommand{\divider}{\textcolor{body!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}
\newenvironment{fullwidth}{%
\begin{adjustwidth}{}{\dimexpr-\marginparwidth-\marginparsep\relax}}
{\end{adjustwidth}}
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}}{\url{#2}}
Here is the code that ended up working for my scenario:
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\usepackage{hyperref}
\colorlet{accent}{blue!70!black}
\begin{document}
\newcommand{\linkedinsymbol}{\faLinkedin}
% \newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\weblinks}[3]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}{\href{#2}{#3}}\hspace{2em}}}
% \newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}{\url{#2}}}
\newcommand{\linkedin}[2]{\weblinks{\linkedinsymbol}{#1}{#2}}
\linkedin{http://linkedin.com/in/varunjain-me}{linkedin.com/in/varunjain}
\end{document}
This minimal example works for me:
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\usepackage{hyperref}
\colorlet{accent}{blue!70!black}
\begin{document}
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}{\url{#2}}}
\linkedin{linkedin.com/in/varunjain-me}{www.linkedin.com/in/varunjain-me}
\end{document}
At least it produces some output... I don't know what exactly you expect, but you can probably take it from here.

subsection command not working in elsevier LaTeX template

I am working on Elsevier template with a single column format, I am facing an issue with subsections command not working as they are displayed like a normal section with wrong numbering, for example
\documentclass[a4paper,fleqn]{cas-sc}
\begin{document}
\section{A}
\subsection{AA}
\subsubsection{BB}
\end{document}
Can anyone help me on how to fix this issue?
You're using it properly. This must be an issue with your class file (cas-sc) that you are using.
I'm not sure if this is by design (which would be a very odd behaviour), but this behaviour is caused by some redefinition in the class file. To workaround this problem one could fix these redefinitions and use
\documentclass[a4paper,fleqn]{cas-sc}
\makeatletter
\renewcommand\subsection{\#startsection{subsection}{2}{\z#}%
{10pt \#plus 3\p# \#minus 2\p#}%
{.1\p#}%
{%\let\#hangfrom\relax
\ssectionfont\raggedright }}
\renewcommand\subsubsection{\#startsection{subsubsection}{3}{\z#}%
{10pt \#plus 1\p# \#minus .3\p#}%
{.1\p#}%
{%\let\#hangfrom\relax
\sssectionfont\raggedright}}
\makeatother
\begin{document}
\section{A}
\subsection{AA}
\subsubsection{BB}
\end{document}
(don't do this if you intend to submit the document to the journal)

Listings adds whitespaces, how to remove it?

Hey guys,
when using listings to present code in my PDF, it adds whitespaces after some characters.
This is how it looks in the pdf (I'm not allowed to post images because of reputation, 'hence add ".png" to the url, sorry).
I'm using the following code to add the listings.
\newcommand{\lstchange}[2]{
\lstset{breaklines=true,
frame=single,
captionpos=b,
basicstyle={\ttfamily\footnotesize},
showspaces=false,
showstringspaces=false,
showtabs=false,
numberstyle={\ttfamily\footnotesize},
keywordstyle={\bfseries\color{blue}},
stringstyle=\color{darkorange}\ttfamily,
commentstyle=\color{OliveGreen},
language=#1,
morekeywords={#2} }
}
% ...
\lstchange{bash}{svn , cd, gnome-open}
\begin{lstlisting}[caption=someCaption, label=someLabel]
#!/bin/bash
svn checkout http://opendecisionrepository.googlecode.com/svn/trunk/sources/web-interface/src/main/webapp odr-appetizer-2 -r 621
cd odr-appetizer-2
#open drawing.xhtml
gnome-open drawing.xhtml
\end{lstlisting}
Does anyone of you have an idea why this happens? Even if I use the standard example from the latex wikibook this happens.
Maybe this is also important for you, the config file:
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=3cm, a4paper]{geometry}
\usepackage[pdftex]{graphics}
\usepackage{fancyhdr}
\usepackage{%
array,
booktabs,
dcolumn,
rotating,
shortvrb,
tabularx,
units,
url,
xcolor,
lastpage,
longtable,
lscape,
multirow,
amssymb,
amsmath,
float,
chngpage,
colortbl,
helvet,
listings
}
Thanks in advance!
Cheers,
Ben
Cannot reproduce this here (with \documentclass{article}), it looks fine. I only had to comment out "OliveGreen" because it was unknown.

Resources