Can't compile latex document - latex

Can't compile an old document of my CV that requires additional latex libraries. Can someone recommend a tex variant that should handle it.
tried
latex
! Fatal Package fontspec Error: The fontspec package requires either XeTeX or
(fontspec) LuaTeX.
luatex
! Undefined control sequence.
l.1 \documentclass
[a4paper,10pt]{article}
xetex
I can't find the format file `xetex.fmt'!
Latex code
\documentclass[a4paper,10pt]{article}
%A Few Useful Packages
\usepackage{marvosym}
\usepackage{fontspec} %for loading fonts
\usepackage{xunicode,xltxtra,url,parskip} %other packages for formatting
\RequirePackage{color,graphicx}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[big]{layaureo} %better formatting of the A4 page
% an alternative to Layaureo can be ** \usepackage{fullpage} **
\usepackage{supertabular} %for Grades
\usepackage{titlesec} %custom \section
\usepackage{supertabular}
%Styling Itemizations
\usepackage{enumitem}
\setlist{nolistsep}
\setitemize[1]{labelindent=\parindent, label=$\triangleright$}
%Setup hyperref package, and colours for links
\usepackage{hyperref}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}
%FONTS
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule]
\titlespacing{\section}{0pt}{3pt}{3pt}
%Tweak a bit the top margin
\addtolength{\voffset}{-1.3cm}

worked fine compiling with
xelatex

Related

LaTeX Error: Option clash for package hyperref

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{import}
% links Symbol
\usepackage{bbding,pifont}
\usepackage[hidelinks]{hyperref}
% Redefinition:
\let\orighref\href
\newcommand{\hrefa}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{...code}{#1}}
\newcommand{\hrefb}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{xxx/}{#1}}
\newcommand{\hrefc}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{ccc}{#1}}
\newcommand{\hrefd}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv/}{#1}}
\newcommand{\hrefe}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv}{#1}}
\newcommand{\hreff}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv}{#1}}
% end links symbol
% personal data
\name{...}
\title{}
\address{..}{}{}
\phone[mobile]{+...4}
\email{xxx#a.com}
\extrainfo{\hrefd{xc.com}}
%\photo[64pt][0.4pt]{photo.jpg}
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\begin{document}
Error:
LaTeX Error: Option clash for package hyperref.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.40 \begin{document}
The package hyperref has already been loaded with options:
[hidelinks]
There has now been an attempt to load it with options
[unicode]
Adding the global options:
hidelinks,unicode
to your \documentclass declaration may fix this.
Try typing <return> to proceed.
when i try to convert to pdf, i get an empty html file.
The moderncv class automatically loads the hyperref package. You can use \PassOptionsToPackage{hidelinks}{hyperref} to make sure it is loaded with the options you want.
(although your hidelinks option won't make a big difference because moderncv sets the line width of the link boxes to zero, so they are already invisible)
\PassOptionsToPackage{hidelinks}{hyperref}
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{import}
% links Symbol
\usepackage{bbding,pifont}
% personal data
\name{...}
\title{}
\address{..}{}{}
\phone[mobile]{+...4}
\email{xxx#a.com}
%\extrainfo{\hrefd{xc.com}}
%\photo[64pt][0.4pt]{photo.jpg}
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\begin{document}
test
\url{stackoverflow.com}
\end{document}

Citation not getting displayed - instead the alias is getting displayed in the pdf

I am trying to use \cite to cite items from bibliography.bib. However, my citations are not working properly.
The environment, code and output are as below:
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath,amsfonts,eurosym,geometry,ulem,graphicx,caption,color,setspace,sectsty,comment,footmisc,caption,pdflscape,subfigure,array,hyperref,booktabs,dcolumn,threeparttable, adjustbox,apacite,dirtytalk,multirow,tabularx,booktabs,longtable,lscape,placeins,tikz}
\usepackage[backend=biber,natlib,style=author-year,citestyle=authoryear]{biblatex}
\usepackage{ulem}
\usepackage{float}
\restylefloat{table}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}
\usepackage{pst-func}
\psset{unit=2cm}
\usepackage{hyperref}
\hypersetup{colorlinks=true,urlcolor=blue,citecolor=blue,linkcolor=red}
\usepackage[center]{caption}
\usepackage{setspace}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{lscape}
\usepackage[english]{babel}
\usepackage{color}
\addbibresource{bibfile.bib}
\begin{document}
This is a \cite{sample}.
\end{document}
The cite takes reference from my .bib file, which is in the same folder. Here I have attached a sample citation.
#article{sample,
title={What is the price elasticity of housing demand?},
author={Hanushek, Eric A and Quigley, John M},
journal={The Review of Economics and Statistics},
pages={449--454},
year={1980},
publisher={JSTOR}
}
The output that I am getting looks like
Author Year with year linking to the bibliography section. However, I want it like Author, Year with the entire phrase linking to the bibliography section
Could you please help me with this issue?
Thank You :)
P.S. : I know my environment is not perfect. It has some packages repeated twice. :)
NEVER IGNORE ERROR MESSAGES! After an error, latex only recovers enough to syntax check the rest of the document. There is no point at even looking at what might or might not be valid output while there are still errors!
There are several major problems:
don't load packages multiple times and in particular don't load them multiple times with different options. An error message in the log file will explicitly tell you about the option clash
don't load incompatible package like apacite and biblatex in the same document. An error message in the log file with explicitly tell you that these two packages are not compatible
the biblatex option is called natbib, not natlib. An error message will explicitly tell you that it does not know the option natlib
the biblatex style is called authoryear, not author-year. An explicit error message will tell you that author-year style is not found
... and then there are many other duplicate, unnecessary or obsolete packages. You should clean up your preamble and only load the packages you need. Also hyperref should be loaded after the other packages.
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath,amsfonts,eurosym,geometry,ulem,graphicx,caption,color,setspace,sectsty,comment,footmisc,caption,pdflscape,subfigure,array,
%hyperref,
booktabs,dcolumn,threeparttable, adjustbox,
%apacite,
dirtytalk,multirow,tabularx,booktabs,longtable,
%lscape,
placeins,tikz}
\usepackage[backend=biber,natbib,style=authoryear,citestyle=authoryear]{biblatex}
%\usepackage{ulem}
\usepackage{float}
\restylefloat{table}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}
\usepackage{pst-func}
\psset{unit=2cm}
%\usepackage{hyperref}
%\usepackage[center]{caption}
%\usepackage{setspace}
%\usepackage{epsfig}
%\usepackage{graphics}
%\usepackage{lscape}
\usepackage[english]{babel}
%\usepackage{color}
\usepackage{hyperref}
\hypersetup{colorlinks=true,urlcolor=blue,citecolor=blue,linkcolor=red}
\begin{filecontents*}[overwrite]{\jobname.bib}
#article{sample,
title={What is the price elasticity of housing demand?},
author={Hanushek, Eric A and Quigley, John M},
journal={The Review of Economics and Statistics},
pages={449--454},
year={1980},
publisher={JSTOR}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
This is a \cite{sample}.
\end{document}

"Error Producing PDF" when markdown contains a horizontal rule: --- or ***

When my Markdown file contains a horizontal rule --- or *** I receive an error regarding \Linethickness -> \Protect
I understand there have been issues with MiKTeX recently, however I am unsure whether they apply here.
I have been experiencing this issue since yesterday morning, when I was playing around trying to get the Lato font package to work with a set of Markdown files I need to convert to PDF. It had been working fine (asides from the font issue).
This could have happened when I updated MiKTeX, although at the time I hadn't realised that could be the case, as I was also playing with the templates, YAML, PS Script etc.
Since then I've been reading about the MiKTeX issue and I've tried further updates, updating package database, building formats, refreshing file name database and uninstalling and reinstalling. I have read the background in the comments section on GitHub but the suggestions there do not seem to have solved it for me, whereas they have for others.
This makes me question whether this is related, but I am relatively new to Tex, Markdown etc.
The original file was longer and more complex, but this Markdown
# Sample File
Test Test Test
---
Produces the same error
Error producing PDF.
! Missing number, treated as zero.
<to be read again>
\protect
\linethickness ->\protect
\linethickness
\setlength #1#2->#1 #2
\relax
\#rule ...#tempdimb {#2}\setlength \#tempdimc {#3}
\advance \#tempdimc \#temp...
l.362 ...nter}\rule{0.5\linewidth}{\linethickness}
Removing the --- allows the pdf to generate in both the above example and my more complex markdown file, even with templates.
I am unsure if linethickness is within the graphics package, when I look at package information I can't see anything that obviously indicates it is.
I would simply remove the offending lines but they are used throughout the remainder of the markdown files and I would prefer to find a fix, with your help, if possible!
Please could you let me know if I'm barking up the wrong tree with this recent MiKTeX issue or not, and if not, where I might be going wrong.
Many Thanks in advance.
Update:
I ran this command
pandoc -s sample.md -o sample.tex
to produce this tex:
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\#ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1cm]{geometry}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\date{}
\begin{document}
\setcounter{errorcontextlines}{40}
\hypertarget{sample-file}{%
\section{Sample File}\label{sample-file}}
Test Test Test
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\end{document}
meanwhile, I tried this (as root in a latest RStudio Debian install):
~# sed 's,\\linethickness,0.5000000000pt,g' < pandoc/pandoc > /usr/lib/rstudio-server/bin/pandoc/pandoc
where the 1st pandoc/pandoc is a copy of the original from package. That keeps the same string length and valid number so that the binary won't break. That writes the hrule as:
\begin{center}\rule{0.5\linewidth}{0.5000000000pt}\end{center}
and MiKTeX seems fine with it (at least TeXworks compiles the pdf).
HTH
bye

Package biblatex Error

I have a latex document and wanted to add references using bibtex. I created a file and saved it with the extension .bib. In the latex file I use \usepackage{biblatex} and then
\bibliographystyle{style}
\bibliography{PHcite}
When I compile I get this error:
./Physics IA.tex:153: Package biblatex Error: '\bibliographystyle' invalid.
See the biblatex package documentation for explanation.
Type H for immediate help.
...
l.153 \bibliographystyle{style}
?
./Physics IA.tex:154: LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H for immediate help.
...
l.154 \bibliography
{PHcite}
You just have to look at one of the biblatex examples in order to see what the problem is:
Don't use
\documentclass[<options>]{<class>}
% ...
\begin{document}
% ...
\bibliographystyle{<style>}
\bibliography{<bib>}
% ...
\end{document}
Instead use
\documentclass[<options>]{<class>}
% ...
\usepackage[
style = <style>,
<other options>
]{biblatex}
% ...
\addbibresource[<options>]{<bib>.bib}
% ...
\begin{document}
% ...
\printbibliography[<options>]
% ...
\end{document}
Reference:
What to do to switch to biblatex?
What is the difference between BibTeX and biblatex?

Latex: PDF does not print the bibliography from the .bib file

I am trying to put the bibliography in my .tex file, but it does not work. I think I have still some problems with biber/biblatex. I already updated all biblatex files through miktex update manager. But I still become the error:
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) myfile
(biblatex) and rerun LaTeX afterwards.
and
empty bibliography
and so on.
I've tryed all possible things, nothing helped me.
And I do run correctly PDFLaTeX + Biblatex + 2PDFLaTeX.
I use TexMaker.
My preamble looks like this:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%bibliography
\usepackage[backend=biber]{biblatex}
\addbibresource{references.bib}
\usepackage{csquotes}
\usepackage{tocbibind}

Resources