doxygen: How to link to an external URL with # (hash) sign? - latex

I am trying to link an URL which contains a # (hash) sign, see upstream code here:
http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_8.2.html#para_4bcb841e-c6bf-4e26-82a5-3fad3c942da0
Everything works as expected with HTML output, but things gets nasty with LaTeX output (PDF). It fails with:
! Illegal parameter number in definition of \Hy#tempa.
<to be read again>
p
l.153 ...ageref{classgdcm_1_1ImageRegionReader}}{}
?
Looking at the generated code, I see:
\href{http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_8.2.html#para_4bcb841e-c6bf-4e26-82a5-3fad3c942da0}
I cannot simply escape the # sign with a backslash since it would break the HTML output (but fix the LaTeX output). I found on the web that including bigfoot before hyperref can solve this sort of issue, but this did not work for me using the following trick in the doxyfile:
## -1650,7 +1650,7 ## PAPER_TYPE = letter
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES = bigfoot
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
Is there anything simple to include a URL with # sign that works for both HTML and LaTeX output ?
EDIT: I found out that doxygen generate the following code:
% Hyperlinks (required, but should be loaded last)
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex,pagebackref=true]{hyperref}
\else
\usepackage[ps2pdf,pagebackref=true]{hyperref}
\fi
So I cannot explicitly \usepackage{hyperref} after \usepackage{bigfoot} since this creates some sort of conflict.
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
! LaTeX Error: Option clash for package hyperref.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.101 \else

Related

latex in text citations error: citation undefined

I am wanting to do in text citations for my dissertation. I will upload a simplified version of what i am seeing. The issue is that i keep getting "undefined citations" where i only get the citation key out in my pdf irrespective of which compiler i use.
I also keep getting an error saying that the bibliography is empty. But when my friend uses the exact code i have and copies the references and everything into his overleaf environment it works. I could not get it working with miktex and texmaker. Please help
I have checked a lot of articles of what is available and i swear im following what they are doing but i cant get any further
Initially, my idea is to pull the citations from another file because ill be using these citations in multiple documents. I have successfully setup the .bib file which will update as i add more references to Zotero (my reference manager). I tried to pull citations from the .bib file by coding in the file directory, but no luck there.
I then tried to not use the "file directory approach" and just have a references file in the same folder as the .tex file. But that didnt work either.
my code is as follows:
\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage[style=ieee]{biblatex}
\addbibresource{refs.bib} %%updated from References.bib
%document headings
\title{Practice}
\author{Justin Smith}
\begin{document}
%Cover Page
\maketitle
\textbf{This page represents the cover page}\newline
\textit{Report will begin here}
\thispagestyle{empty}
\pagebreak
%Introduction
\section{Introduction}
The introduction for the report will be inserted here
\pagebreak
%end Introduction
%Literature Survey
\section{Literature Survey}
\subsection{Referencing Examples}
This section serves to use a reference and understand how to implement references as well as generate a reference list at the end of this report.\\
The citation test \cite{schmidtPreprocessingMethodologyEnhance2019}\\
\pagebreak
%Reference List
\section*{Reference List}
%%\bibliographystyle{IEEE}
%%\bibliography{C:/Users66smi/OneDrive/University of Pretoria/Zotero/MyZoteroLibrary.bib}
%%\printbibliography[title = Reference List]
%%\bibliography{MyZoteroLibrary.bib}
\end{document}
EDIT:
Upon trying to do what #celdor initially said said i still run into the same issue. The following screenshots add to the initial question.
Screenshot showing code and issue directly
Screenshot showing Latex "Configure" settings
From the Log file, the following logs detail relevant warnings
LaTeX Warning: Citation 'schmidtPreprocessingMethodologyEnhance2019' on page 3
undefined on input line 36.
Underfull \hbox (badness 10000) in paragraph at lines 36--37
[]
[3]
LaTeX Warning: Empty bibliography on input line 39.
(Latex test.aux)
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) "Latex test"
(biblatex) and rerun LaTeX afterwards.
Package logreq Info: Writing requests to '"Latex test".run.xml'.
\openout1 = `"Latex test.run.xml"'.
)
Extra information:
The following screenshots are of the Project folder
First, latexsym is an old package superseded by amssymb. I looked at the file and its last update was in 1998!
As to your issues, assuming your text file is main.tex, try the following:
Clean your project folder from all auxiliary *.aux; the best way to do that is to issue latexmk -C in your project folder.
Additionally, remove main.bbl
make sure your *.bib file is in the root project folder
add backend=biber to list of options of biblatex.
Then, run:
pdflatex main.tex # or xelatex main.tex or lualatex main.tex etc.
biber main
pdflatex main.tex # see above
Without *.bbl file, the first run of pdflatex does not produce any reference list and latex may issue a warning. With an old *.bbl file, you will get wrong citations. After the whole sequence is executed, main.pdf should have the correct citation and a reference list.
Remember \bibliography is incompatible with biblatex. The correct macro to create bibliography list is \printbibliography. It will issue \section* in article or \chapter* in report/book for a title and format it according to settings in a document class.
Here, I created References.bib with a dummy article:
#ARTICLE{schmidtPreprocessingMethodologyEnhance2019,
author = {Other, Anthony Norman},
title = {Some things I did},
year = {2014},
journal = {J.~Irrep. Res.},
volume = {1},
number = {1},
pages = {1-10}
}
and run the code as suggested, and frankly I get expected results without any errors!
The full code:
\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage{amssymb} %superseds latexsym
\usepackage{graphicx}
\usepackage[backend=biber,style=ieee]{biblatex}
\addbibresource{References.bib}
%document headings
\title{Practice}
\author{Justin Smith}
\begin{document}
%Cover Page
\maketitle
\textbf{This page represents the cover page}\newline
\textit{Report will begin here}
\thispagestyle{empty}
\pagebreak
%Introduction
\section{Introduction}
The introduction for the report will be inserted here
\pagebreak
%end Introduction
%Literature Survey
\section{Literature Survey}
\subsection{Referencing Examples}
This section serves to use a reference and understand how to implement references as well as generate a reference list at the end of this report.\\
The citation test \cite{schmidtPreprocessingMethodologyEnhance2019}\\
\clearpage
\printbibliography[title = Reference List]
\end{document}
and here's the screenshot:
The answer as suggested by #samcarter_is_at_topanswers.xyz
is that I was not using biber.
To do this on textmaker proceed to Options/Configure Textmaker. A configuration window will appear. Under the Commands Window locate "Bib(la)tex" and set the designation to "biber %". This will solve the issue.
Setting Update
A similar procedure can be followed on texstudios
See the below link on how to make sure textmaker uses this setting for reference.
https://tex.stackexchange.com/questions/44040/biblatex-biber-texmaker-miktex
thank you for everyones efforts in solving this problem.

Getting compilation error with latex file in overleaf

This is my first time with overleaf. I have a latex template, and when I try to compile it shows the following error:
Emergency stop.
<*> header.tex
*** (job aborted, no legal \end found)
Here is how much of TeX's memory you used:
28699 strings out of 480906
561966 string characters out of 5908280
1147859 words of memory out of 5000000
43764 multiletter control sequences out of 15000+600000
539149 words of font info for 32 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
73i,1n,97p,10101b,276s stack positions out of 5000i,500n,10000p,200000b,80000s! ==> Fatal error
occurred, no output PDF file produced!
I am not sure what to do.
Can someone please suggest how I can solve this problem?
In case you need some more information, then please let me know. I will add here.
Edit: header file that is throwing error: http://www.itextpad.com/pH0GJ5Bfmg
The document you have provided is simply a preamble file. It does not contain the document body \begin{document} ... \end{document} hence the Emergency stop fatal error.
What you should do is save this file under some name, say mypreamble.tex. Create a new .tex file and have both files under the same file directory. Finally, in the new file
\include{mypreamble.tex}
\begin{document}
\thesistitle
\section{Section 1}
/*
* Write stuff and commands here
*/
\end{document}
The file you have provided does not seem to be a classic template which you copy-paste, change some fields and have your product. It seems to look more like a file containing some functions and predefinitions which helps you structure your file in a certain way. I would suggest looking for another template that includes a document main body, which you would be able to implement and use immediately.

\imagegraphics doesn't interpret \ escape in filename

I'm trying to insert a background image with the beamer package using the following:
\usebackgroundtemplate{%
\includegraphics[width=\paperwidth,keepaspectratio]{/path/to_file/background.png}%
}
The problem I'm having is that my background file path has an underscore in it, as I put in the example above. (This is my home directory on OS X, so I can't really change it.) When I generate this via pandoc the resultant latex file has the underscore escaped with a \, so it looks like this:
\usebackgroundtemplate{%
\includegraphics[width=\paperwidth,keepaspectratio]{/path/to\_file/background.png}%
}
but this makes it impossible for includegraphics to find the file and so it fails at that point.
If I manually remove the \ from the latex, or move the file to, say, the root directory, so that there is no underscore in the path, all is well. Here's the exact error:
LaTeX Warning: File `/Users/my\_name/Downloads/background.png' not fou
nd on input line 102.
! Package pdftex.def Error: File `/Users/my\T1\textunderscorename/Down
loads/background.png' not found: using draft setting.
So is there something I can do to tell includegraphics that the name is escaped, or to remove the escaping?
Here's the YAML:
---
name: John Doe
backgroundImage: /Users/my_name/Downloads/background.png
---
Text to add to template:
$if(backgroundImage)$
\usebackgroundtemplate{%
\includegraphics[width=\paperwidth]{$backgroundImage$}%
}
YAML values are interpreted as Markdown, unless specified otherwise. The backgroundImage is hence translated into LaTeX when used within $backgroundImage$.
The solution is to force literal interpretation of the input by telling pandoc that you know what you are doing, and that the input is already formatted as LaTeX:
---
name: John Doe
backgroundImage: '`/Users/my_name/Downloads/background.png`{=latex}'
---
This is based on the raw attribute extension, which is enabled by default for pandoc flavored Markdown.

Pandoc Error producing PDF with markdown body text and YAML metadata file

I'm running the following Pandoc 2.0.3 command on the Mac Terminal command line:
pandoc one.md "metadata.yaml" -o two.pdf
This should take the markdown file one.md and output two.pdf using the yaml file metadata.yaml, a minimal version of which is:
---
header-includes:
- \usepackage{fancyhdr}
...
This Pandoc run produces a PDF as expected for the following version of one.md:
# Report
However, it fails to produce a PDF for the following version of one.md, which contains body text:
# Report
Lorem.
The resulting error message is:
Error producing PDF.
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.65 header-includes: - \usepackage
I don't understand why including that one word creates a failure.
Your one.md likely doesn't end with a newline. Pandoc concatenates all input files, adding a single newline between files. So the resulting input will be:
# Report
Lorem.
---
header-includes:
- \usepackage{fancyhdr}
...
As a result, the opening dashes of the YAML block are interpreted as underlines for Lorem., which is then read as a second-level header. This doesn't happen if the line above the --- dashes is an ATX-style header.
Just add a newline to the end of one.md and everything should work the way you expected.

pdftex driver of hyperref package doesn't work with utf-8 encoded .tex files

i use pdflatex to generate pdf files. my source files are all utf-8 encoded because of non-english characters. without \usepackage{hyperref} code, they can be compiled without any problem. but when i put \usepackage{hyperref} (even without any \href{}{} code) in the package list, an error would occur, saying
**************************************
! Use of \#chapter doesn't match its definition.
\CJK#altchar ...fx \csname \reserved#a \endcsname
\relax \CJKsymbol {\#tempc...
l.1 \chapter{XXX}
?
**************************************
where "XXX" represents non-english characters.
then i googled a lot, finding the cause is that hyperref uses pdftex drivers, which doesn't work with utf-8 encoded files. i checked this page: http://www.tug.org/applications/hyperref/manual.html , and failed to find any driver suitable for pdflatex.
i tried \usepackage[utf8]{inputenc}, but still couldn't get it to work.
so anyone could help me? thank you!
Have you tried loading hyperref using \usepackage[unicode]{hyperref}, or, equivalently, specifying \hypersetup{ unicode = true } right after ? This should enable you to use unicode characters in bookmarks.
Try this, works for me. Instead of:
\usepackage[pdftex, unicode,
pdfauthor={çç êÊ},
pdftitle={T\'{o}picos Avançados ôô},
pdfsubject={Trabalho 6},
pdfkeywords={a1, a2},
pdfproducer={Latex with hyperref},
pdfcreator={pdflatex}]{hyperref}
I do:
\usepackage[pdftex, unicode,
pdfproducer={Latex with hyperref},
pdfcreator={pdflatex}]{hyperref}
\hypersetup{
pdfauthor={çç êÊ},
pdftitle={T\'{o}picos Avançados ôô},
pdfsubject={Trabalho 6},
pdfkeywords={a1, a2},
}
I hope it works for you too.

Resources