Problem between ziffer and siunitx package - latex

I have the following code. In overleaf this gives me 2 2 and 2 3 nm instead of the `2.2 and 2.3 nm´ aimed for. Is this a known problem? Is the ziffer package obsolete, because the correct formatting is already implemented into the siunitx package?
\documentclass{scrbook}
\usepackage[locale=DE,separate-uncertainty]{siunitx}
\usepackage{ziffer}
\begin{document}
\sisetup{
input-decimal-markers= {,},
output-decimal-marker = {.},
}
\num{2,2} and \SI{2,3}{nm}
\end{document}
If i comment out the ziffer package everything works fine.

Related

Missing = inserted for \ifnum

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.

Intermittent reference (bibliography) in Latex

I have TexStudio and MikTex to edit Latex files on my PC versions 4.0.3 and 4.4, respectively. However, my bibfiles references work in an randomly way: sometimes they're recognized, in others, they are not.
Minimal Reproducible Example
\documentclass[msc]{ppgccufmg}
\begin{document}
Testing the reference \cite{COAF}
\ppgccbibliography{bibfile}
\end{document}
Bibfile.bib
#misc{COAF,
title = {O que é lavagem de dinheiro e financiamento do terrorismo},
howpublished = {\url{https://www.gov.br/coaf/pt-br/pastas-antigas-disponiveis-para-pesquisa/o-sistema-de-prevencao-a-lavagem-de-dinheiro/o-que-e-o-crime-de-lavagem-de-dinheiro-ld}},
note = {Accessed: 2010-09-30}
}
Class ppgccufmg: https://github.com/verlab/ppgccufmg
(Delete \RequirePackage{etextools} in line 40)
Error:
Two problems:
latex ignores everything after \end{document}, if you want a bibliography, you must place it before it
you are using \url{...} in your .bib file. You need to load a package like hyperref or url which defines this macro
\documentclass[msc]{ppgccufmg}
\usepackage{hyperref}
\begin{document}
Testing the reference \cite{COAF}
\ppgccbibliography{\jobname}
\end{document}

Inserting code in this LaTeX document with indentation

How do I insert code into a LaTeX document? Is there something like:
\begin{code}## Heading ##
...
\end{code}
The only thing that I really need is indentation and a fixed width font. Syntax highlighting could be nice although it is definitely not required.
Use listings package.
Simple configuration for LaTeX header (before \begin{document}):
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
You can change default language in the middle of document with \lstset{language=Java}.
Example of usage in the document:
\begin{lstlisting}
// Hello.java
import javax.swing.JApplet;
import java.awt.Graphics;
public class Hello extends JApplet {
public void paintComponent(Graphics g) {
g.drawString("Hello, world!", 65, 95);
}
}
\end{lstlisting}
Here's the result:
You could also use the verbatim environment
\begin{verbatim}
your
code
example
\end{verbatim}
Here is how to add inline code:
You can add inline code with {\tt code } or \texttt{ code }. If you want to format the inline code, then it would be best to make your own command
\newcommand{\code}[1]{\texttt{#1}}
Also, note that code blocks can be loaded from other files with
\lstinputlisting[breaklines]{source.c}
breaklines isn't required, but I find it useful. Be aware that you'll have to specify \usepackage{ listings } for this one.
Update: The listings package also includes the \lstinline command, which has the same syntax highlighting features as the \lstlisting and \lstinputlisting commands (see Cloudanger's answer for configuration details). As mentioned in a few other answers, there's also the minted package, which provides the \mintinline command. Like \lstinline, \mintinline provides the same syntax highlighting as a regular minted code block:
\documentclass{article}
\usepackage{minted}
\begin{document}
This is a sentence with \mintinline{python}{def inlineCode(a="ipsum)}
\end{document}
Specialized packages such as minted, which relies on Pygments to do the formatting, offer various advantages over the listings package. To quote from the minted manual,
Pygments provides far superior syntax highlighting compared to conventional packages. For example, listings basically only highlights strings, comments and keywords. Pygments, on the other hand, can be completely customized to highlight any token kind the source language might support. This might include special formatting sequences inside strings, numbers, different kinds of identifiers and exotic constructs such as HTML tags.
Minted, whether from GitHub or CTAN, the Comprehensive TeX Archive Network, works in Overleaf, TeX Live and MiKTeX.
It requires the installation of the Python package Pygments; this is explained in the documentation in either source above. Although Pygments brands itself as a Python syntax highlighter, Minted guarantees the coverage of hundreds of other languages.
Example:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}[mathescape, linenos]{python}
# Note: $\pi=\lim_{n\to\infty}\frac{P_n}{d}$
title = "Hello World"
sum = 0
for i in range(10):
sum += i
\end{minted}
\end{document}
Output:
Use Minted.
It's a package that facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. The package also provides options to customize the highlighted source code output using fancyvrb.
It's much more evolved and customizable than any other package!
A very simple way if your code is in Python, where I didn't have to install a Python package, is the following:
\documentclass[11pt]{article}
\usepackage{pythonhighlight}
\begin{document}
The following is some Python code
\begin{python}
# A comment
x = [5, 7, 10]
y = 0
for num in x:
y += num
print(y)
\end{python}
\end{document}
which looks like:
Unfortunately, this only works for Python.
Since it wasn't yet mentioned here, it may be worth to add one more option, package spverbatim (no syntax highlighting):
\documentclass{article}
\usepackage{spverbatim}
\begin{document}
\begin{spverbatim}
Your code here
\end{spverbatim}
\end{document}
Also, if syntax highlighting is not required, package alltt:
\documentclass{article}
\usepackage{alltt}
\begin{document}
\begin{alltt}
Your code here
\end{alltt}
\end{document}
Use Pygments !

Adding bibliography to appendices in latex

I am writing my thesis and I am using the chapterbib option. While it makes beautiful bibliographies for my chapters, I can't get it to do the same thing for my appendices.
The preamble:
\documentclass[pdftex, 11pt, onecolumn, openany]{report}
\usepackage{amsmath}
\usepackage[pdftex]{graphicx}
\usepackage{appendix}
\usepackage[sectionbib]{chapterbib}
\usepackage{chapterbib}
\begin{document}
...
\include{background}
\include{ATRPcomp}
\include{CCTcomp}
\appendix
\include{AppCCT}
\end{document}
In each of my chapter sections and appendix I have:
\chapter{Compartmentalization in Catalytic Chain Transfer}
...
\bibliography{references}
Does the chapterbib also work for appendices or is there another option that could help?
I assume the package to work also within the appendix. I fact, when you issue the command \appendix the sectioning commands' behavior is the same, except for the numbering (and perhaps the heading).
In the main matter, the chapter command
\chapter{CCTcomp}
gives you
7 CCtcomp
(7 is an example). The commands sequence
\appendix
\chapter{AppCCT}
gives you
A AppCCT
The bibliography shoud work properly.

pdfLaTeX + memoir class compile error

I'm in the middle of writing my thesis, and was using KOMA-Script. The document compiles just fine. I stumbled upon the memoir class yesterday, and was thinking of giving it a try, so here I am trying to compile with this class instead of KOMA-Script.
First compilation is OK. On second compilation, the document would not build
(./fourier/fourier.tex [98]
! Undefined control sequence.
<argument> ... C\protect \noexpand \protect \bond
\protect \noexpand \protec...
l.1 \chapter
{Homogénéisation numérique par transformée de Fourier rapide}
?
It has apparently not connected to hyperlink (btw, I'm using memhfixc), since I've commented this one out. Here is the preamble of my document, any thoughts?
%\documentclass[draft, 11pt, a4paper, chapterprefix]{scrreprt}
\documentclass[draft, 11pt, a4paper]{memoir}
\usepackage[authoryear, round]{natbib}
\usepackage[french]{babel}
\usepackage[latin1]{inputenc}
\usepackage{pdfsync}
\usepackage[version=3]{mhchem}
\usepackage{pgf}
\usepackage{microtype}
\usepackage{txfonts} % Polices times
\usepackage[notref, notcite]{showkeys}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[bvec]{sbmacros}
\usepackage{micromechanics}
\usepackage{pgfcad}
%\usepackage[breaklinks=true]{hyperref}
%\usepackage{memhfixc} % Pour assurer la compatibilité entre memoir et hyperref
%\newcommand{\url}[1]{\texttt{#1}}
% Options KOMA-Script
% \addtokomafont{caption}{\small}
% \pagestyle{headings}
I found the answer, for those who might be interested. I started to have serious doubts when I realized that the exact same problem occured when I used the KOMA-Script scrbook class instead of the KOMA-Script scrreprt class...
And I finally found that the mhchem package somehow conflicts with those packages. Since I didn't use this package much anyway, I got completely rid of it, and am now using memoir, no problem.

Resources