Can we use the bib file from web for pdf_book in Bookdown? - latex

In Rmarkdown,
we can generate pdf file if we use the bib file from a url.
For example, we set
bibliography: [https://raw.githubusercontent.com/ChoCho66/test/main/text.bib]
In bookdown, we can also generate html book (gitbook, bs4_book)
if we use the bib file from a url.
But pdf_book doesn't work.
It has the following message.
! Undefined control sequence.
\hyper#normalise ...M{ }\catcode `\%\active \let %
\#percentchar \let \%\#per...
l.430 ...content.com/ChoCho66/test/main/text.bib}}
The tex file has wrong since the following:
\bibliography{\url{https://raw.githubusercontent.com/ChoCho66/test/main/text.bib}}
Is there any way to solve this problem?
I want a common code that can compile both html book and pdf book if we use bib url file.

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.

Knit RMarkdown Image ! Package pdftex.def Error: File `~/folder/folder/filename.png' not found: using draft setting

I am having trouble knitting a pdf document with RMarkdown when embedding images. When using the markdown syntax below:
![Image name](~/folder/folder/filename.png)
I get the error:
Package pdftex.def Error: File `~/folder/folder/filename.png' not found: using draft setting.
I have also tried:
``` {r results = 'asis'}
knitr::include_graphics(path = "~/folder/folder/filename.png")
```
And, I get the error:
Unescaped left brace in regex is passed through in regex; marked by <-- HERE in m//\nobreakspace { <-- HERE }/folder/folder/filename/ at C:\Users\NAME~1\AppData\Roaming\TinyTeX\texmf-dist\scripts\texlive\tlmgr.pl line 1847.
Error in grep(paste0("/", x[j], "$"), l) :
invalid regular expression '/\nobreakspace {}/folder/folder/filename$', reason 'Invalid contents of {}'
Calls: ... system2_quiet -> on_error -> parse_packages -> grep
In addition: Warning message:
In grep(paste0("/", x[j], "$"), l) :
TRE pattern compilation error 'Invalid contents of {}'
Warning: LaTeX Warning: Reference `LastPage' on page 1 undefined on input line 153.
Execution halted
I have tinytex installed, but maybe I am missing another LaTeX package? Any guidance would be appreciated.
First, as #samcarter_is_at_topanswers.xyz recommended above, the tilde character cannot be interpreted from Markdown to LaTeX.
Additionally, I had my markdown file in one subfolder and my images in another subfolder. When I was knitting the markdown file, the working directory changes to the subfolder that the markdown file is in causing the file path provided for the images to no longer be understood when using the path folder/folder/filename.png. You can either move the markdown file to the main directory or set the entire file path.
If you move the markdown file to the main directory the file path can look like:
![Image name](folder/folder/filename.png)
or keep in the subfolder and use:
![Image name](entire path/folder/folder/filename.png)
The same goes for using knitr's include_graphics function.

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.

Chinese fonts in English Document of Latex

I would like to ask how to write some Chinese characters (simplified) within an English Latex document? I followed some methods suggested online but none of them are working for me. I am using Texworks to compile my document (pdfLatex).
\usepackage{CJKutf8}
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{bsmi}
你好吗
\end{CJK}
\end{document}
another method is mentioned here,
\usepackage{CJKutf8}
\newcommand{\zh}[1]{\begin{CJK}{UTF8}{gbsn}#1\end{CJK}}
insert whatever Chinese characters you like into the document by typing
\zh{中文}
The error I receive is as following when using the method of CJKutf8 with pdfLaTeX mentioned here,
The log file hopefully contains the information to get MiKTeX going again:
C:\Users\muhd_\AppData\Local\MiKTeX\2.9\miktex\log\miktex-makepk.log
)
!pdfTeX error: miktex-pdftex.exe (file bsmiu30): Font bsmiu30 at 600 not found
==> Fatal error occurred, no output PDF file produced!
Log file is attached here.
The first error in the log file
The process terminated due to an access violation.
suggests that there are some problems with permissions while trying to create the necessary files to use the font for the Chinese letters.
Based on this answer https://tex.stackexchange.com/a/419809/36296 the problem can be fixed by either runing updmap from the command line or Refresh font map files from within the miktex console (in user mode).

html to tex conversion with Pandoc does not produce mathematical mode

I'm working with a Windows machine. I use Rstudio/knitr to write and convert a (R)markdown file to an html file. The source markdown file contains some mathematics typed in the LaTeX language hence the html file contains some Mathjax.
For instance there is the following LaTeX code in the markdown file is:
$H_0:= \{|\mu_x-\mu_y|>S\}$
hence the expected output is:
This output correctly appears in the html file.
But now I try to convert this html file to a tex file:
pandoc -s myfile.html -o myfile.tex
And then I get the following code in the output tex file:
\textbackslash{}( H\_0:=
\textbackslash{}\{\textbar{}\textbackslash{}mu\_x-\textbackslash{}mu\_y\textbar{}\textgreater{}S\textbackslash{}\}
\textbackslash{}) où \textbackslash{}( S \textbackslash{})
which gives the following rendering after compiling with (pdf)latex:

Resources