Missing = inserted for \ifnum - latex

I am using iopart template, and I do not know why get this error :
Missing = inserted for \ifnum. \begin
Missing number, treated as zero. \begin
I really appreciate any help
\documentclass[10pt]{iopart}
%\newcommand{\gguide}{{\it Preparing graphics for IOP Publishing journals}}
%Uncomment next line if AMS fonts required
%\usepackage{iopams}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{nicefrac}
\expandafter\let\csname equation*\endcsname\relax
\expandafter\let\csname endequation*\endcsname\relax
\usepackage{amsmath,mathtools}
\DeclareMathOperator{\cotinv}{cot\,inverse}
\usepackage{amssymb}
\let\amscases\cases
\makeatletter
\def\cases{\#ifnextchar\bgroup\plaincases\amscases}
\def\plaincases#1{\begin{cases*}#1\end{cases*}}
\makeatother
\usepackage{multirow}
\usepackage{subfloat}
\usepackage{subfig}
\usepackage{gensymb}
%\newcommand{\acot}{\cot^{-1}}
\begin{document}
\title[]{}
\author{}
\author{}
\address{Department of}
\vspace{10pt}
\begin{indented}
\item[]November 2022
\end{indented}
\begin{abstract}
lll
\end{abstract}
%
% Uncomment for keywords
\vspace{2pc}
\noindent{\it Keywords}: electronics
%
% Uncomment for Submitted to journal title message
%\submitto{\JPA}
%
% Uncomment if a separate title page is required
\maketitle
%
% For two-column output uncomment the next line and choose [10pt] rather than [12pt] in the \documentclass declaration
\ioptwocol
%
\section{Introduction}\label{sec:introduction}
\end{document}```

I tried to recreate this instance. It first asked for the missing iopart.cls documentclass. I could get that from a GitHub repository belonging to Tianjin University named "etgroup". You can simply find it by searching "iop latex template" in Github. After the second compilation, it asked for a class dependency named iopart10.clo(it's available in the same repository).
Finally, after the third compilation, I could get a PDF output(Please see the figure attached).
Solution: If you are using a local LaTeX IDE/Studio, I recommend updating the packages you are using. Sometimes there are conflicts between some packages but they usually resolve quickly by releasing an update and you might see that there was nothing wrong with your commands.
Alternatively, you may try using an online LaTeX editor. They always have the last version of the most common packages and are equipped with multiple LaTeX render engine types.

Related

Citation undefined on input even though they exist

Hi I'm using Overleaf for my dissertation and this warning started popping up recently:
Citation 'objprogen' on page 1 undefined on input line 8.
This citation is already created as seen below in the 'sources.bib' file:
#article{objprogen,
author={Guo, Wenzhong and Lin, Renjie and Wang, Shiping and Xiong, Neal},
booktitle={2018 9th International Symposium on Parallel Architectures, Algorithms and
Programming (PAAP)},
title={Object Proposal Generation for Unsupervised Object Localization},
year={2018},
volume={},
number={},
pages={235-242},
doi={10.1109/PAAP.2018.00046}}
This is my main.tex file:
\documentclass[a4paper]{article}
\usepackage{blindtext, graphicx}
\usepackage{csquotes}
\usepackage[hidelinks]{hyperref}
\usepackage{url}
\usepackage[style=authoryear-ibid,backend=biber]{biblatex}
\hyphenation{op-tical net-works semi-conduc-tor}
\bibliography{sources.bib}
\begin{document}
\title{Can image recognition systems be successfully integrated with existing VIN databases
irrespective of the vehicle manufacturer}
\author{myname}
\maketitle{}
\input{includes/01-Abstract}
\input{includes/02-Introduction}
\input{includes/03-Literature}
\input{includes/04-Methodology}
\input{includes/05-Findings}
\input{includes/06-Conclusion}
\input{includes/07-Appendix}
\end{document}
I had the same problem and solved it by adding \bibliographystyle{plain} (of course you could in principle use other styles). For me the structure of the tex file is the following
\documentclass[oneside, a4paper, onecolumn, 11pt]{article}
%%some packages%%
\begin{document}
%%% some stuff
\bibliographystyle{plain}
\bibliography{bibfile} %bibfile name without the .bib extension
\end{document}
So contrary to you the \bibliography is also inside the document environment.

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

Missing number treated as zero error when using titlesec package and tableofcontents

Whenever I use the package titlesec and later the command \tableofcontents I get the following error:
I created the following MRE below
! Missing number, treated as zero. <to be read again>}\tableofcontents
In the past this never happened, but since I installed MikTex on my new laptop, those lines below do not work anymore.
Removing the package titlesec seems to work, but I would rather know the actual reason for this problem.
\RequirePackage{fix-cm}
\documentclass[
%draft,
pdftex,
paper=a4,
%paper=portait, % Paper Setting
pagesize=auto,
fontsize=11pt, % Font Size
version=last, % Version
%headsepline, % Line after header
%footsepline, % Line before footer
]{scrartcl}
\KOMAoptions{parskip=true}
% Depth of content table
\usepackage{titlesec}
\begin{document}
\tableofcontents
\newpage
Test
\end{document}

Left justification of nomenclature description in LaTeX

I'm using a LaTeX template (provided by ASME) to write a conference paper.
The asme2e.cls class defines a "nomenclature" environment as follows:
% Nomenclature environment
\newbox\tempbox
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\setbox\tempbox\hbox{##1.\quad}
\hangindent\wd\tempbox\noindent{##1}\quad\ignorespaces##2\par}
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
which is used, in the .tex source file, as follows:
\begin{nomenclature}
% [...]
\entry{$C_{visc}$}{Viscous friction coefficient.}
\entry{$M$}{Spool mass.}
% [...]
\end{nomenclature}
resulting in the description texts not being left justified (since a fixed horizontal space is inserted between the symbol (e.g.: M) and the description (e.g.: Spool mass.), but the symbols have different lengths (e.g.: Cvisc is longer than M).
Is there a way to fix the class to have left-justified descriptions?
(I did a few experiments with \dimexpr and the calc package, but just got a bunch of errors).
(I also asked ASME if they could provide an updated template, but I'm still waiting for their feedback...)
I couldn't solve the problem, but I found a "quick and dirty" workaround, using the Tabbing and setspace packages.
Here is the new .tex source:
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
{\setstretch{1.1}
\begin{tabbing}
\noindent
% [...]
\entry{$C_{visc}$}\quad\quad\={Viscous friction coefficient.}\\
\entry{$M$}\>{Spool mass.}\\
\entry{$v$}\>{Spool velocity.}\\
% [...]
\end{tabbing}
} % end \setstretch
\end{nomenclature}
%[...]
(Clearly, I'm completely bypassing the \entry command defined by the asme2e.cls class for the nomenclature environment).
I also tried to edit the asme2ej.cls file but nothing working for me. Then I ended up using the tabbing and set space packages. However, I did not use the \setstretch, and my document compiled just fine.
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
\begin{tabbing}
\noindent
\entry{XYZ}\quad\quad\={This is an example}\\
\entry{PQR}\>{This is an example}\\
\entry{ZXC}\>{This is an example}\\
\entry{CVN}\>{This is an example}\\
\end{tabbing}
\end{nomenclature}
%[...]
I ran into a similar issue when submitting a paper to an ASME journal. My solution was to edit the asme2e.cls file:
\newenvironment{nomenclature}{%
\newcommand\entry[2]{\noindent\hbox to 0.05\textwidth{##1}\ignorespaces##2\par}
\section*{Nomenclature}}{\par\addvspace{12pt}}
You can change the amount of indentation by changing "0.05\textwidth".
I'm not sure if this is what you're asking, but see the following MWE:
\documentclass[12pt]{article}
\newlength{\nomenlabelindent}
\setlength{\nomenlabelindent}{4em}
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\hangindent\nomenlabelindent\noindent\makebox[\nomenlabelindent][l]{##1\quad}\ignorespaces##2\par}%
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
\begin{document}
\begin{nomenclature}
\entry{$A$} {Parameter}
\entry{$B$} {Parameter}
\entry{$C$}{Parameter}
\entry{$D$}{Parameter}
\entry{$E$}{Parameter}
\end{nomenclature}
\end{document}
Output:
Nomenclature

Resources