Left justification of nomenclature description in LaTeX - 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

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.

Latex ClassicThesis - The numbering of the paragraphs does not appear

I need one more numbered level for my report. I used \paragraph{title} but it only appears without numbering.
In the config file, the paragraph is described as:
\titleformat{\paragraph}[runin]
{\normalfont\normalsize}{\theparagraph}{0pt}{\spacedlowsmallcaps}
I believe that the command \theparagraph is responsible for the numbering. Why doesn't it appear?
I searched the net for answers and tried the following commands (at once) before the beginning of the document:
\setcounter{secnumdepth}{\paragraphnumdepth}
Replace the previous command to get rid of run-in with:
\titleformat{\paragraph}
{\relax}{\textsc{\MakeTextLowercase{\theparagraph}}}{1em}{\normalsize\itshape}
\renewcommand{\theparagraph}{\thesubsection.\arabic{paragraph}}
I put the last two commands in \makeatletter and \makeatother.
The paragraph name appears like the section names now, but still no numbers. Any ideas? Here is a small example that works because I didn't include the classicthesis config files.
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{\paragraphnumdepth}
\begin{document}
\chapter{Chapitre}
\section{Introduction}
\subsection{Première sous-partie}
\subsubsection{Un cran en dessous}
\paragraph{Paragraphe with number: what I would like in my report}
Functional here because the problem clearly comes from the two classicthesis config files...
\end{document}
Thank you

How to automatic break lines in latex?

I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.

"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

Figures occurring after ^ and _ macros (was: LaTeX limitation?)

I've hit an annoying problem in LaTeX. I've got a tex file of about 1000 lines. I've already got a few figures, but when I try to add another figure, It barfs with:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.937 \begin{figure}[t]
If I move the figure to other parts of the file, I can get similar errors on different lines:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.657 \paragraph
{A Centering Algorithm}
If I comment out the figure, all is ok.
%\begin{figure}[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
%\end{figure}
If I keep just the begin and end like:
\begin{figure}%[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
\end{figure}
I get:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.942 \end
{figure}
At first, I thought maybe LaTeX has hit some limit, and I tried playing with the ulimits, but that didn't help. Any ideas?
i've got other figures with graphics already. my preamble looks like:
\documentclass[acmcsur,acmnow]{acmtrans2n}
\usepackage{array}
\usepackage{lastpage}
\usepackage{pict2e}
\usepackage{amsmath}
\usepackage{varioref}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{qtree}
\usepackage{rotating}
\usepackage{tree-dvips}
\usepackage{mdwlist}
\makecompactlist{quote*}{quote}
\usepackage{verbatim}
\usepackage{ulem}
I found, not that it's a problem with \textsuperscript, but that it's with a ^ def I picked up from http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode . The fix is to put the use of ^ in {}, as in I've put entire sections where I use lots of ^ and _ in {}. Hurrah!
During the end of my Master Thesis I also had the problem that after some amount of figures, I got an error without any special error message. After I read you thread, I also tried something with the packages included and in the end I was successful by taking out the \usepackage{pxfonts} and \usepackage{txfonts}. Yeah, finally.. I almost went crazy.. ;)
If I Google for "latex undefined control sequence" I get this.
I've successfully included a graphic into LaTeX using something like this:
\usepackage{amsmath,amsthm,graphicx}
...
I just wanted to test adding an image to a \LaTeX file:
\includegraphics[scale=0.60]{basic-info.png}
I typeset an entire dissertation of 200 pages with lots of figures in LaTeX and didn't run into a limit like that. I'd bet on a syntax problem first before I'd assume a size issue.
Your error lies elsewhere. I wouldn't be the least surprised if it turned out to be the document class. Try altering your document for \documentclass{article} and see where you get. If that fixes the problem you can complain to the ACM (ROTFLMAO—I've dealth with ACM).
If that doesn't fix, the problem, slip in a \tracingall somewhat before the offending figure or section, put the results into http://pastebin.com/, and let us know.
Please receive the thanks of a (formerly) utterly-confounded graduate student. Quick clarification for other users:
{The quickest ^{way} to put this solution into practice is to bracket all sections of text involving the character ``\^'' as shown here.}

Resources