How may I convert a three-digit Arabic number (Perl [0-9][0-9][0-9]) to a three-digit English representation ([zero-nine][zero-nine][zero-nine]) - latex

The alternative is to use Roman numerals, for which a package is
available. I am using the LaTeX catchfile package and the \input{}
command to associate a title in a set of TITLE files with \section{}
commands in a set of DOCUMENT files.
I would like to have a file of catchfile definitions, with records
such as:
\CatchFileDef{\t-001}{title-001.tex}{}
\CatchFileDef{\t-002}{title-002.tex}{}
\CatchFileDef{\t-003}{title-003.tex}{}
But LaTeX does not allow numerical labels such as "\title-003".
Roman numerals are workable:
\CatchFileDef{\ti}{title-001.tex}{}
\CatchFileDef{\tii}{title-002.tex}{}
\CatchFileDef{\tiii}{title-003.tex}{}
but are ugly in comparison with:
\CatchFileDef{\tzerozeroone}{title-001.tex}{}
\CatchFileDef{\tzerozerotwo}{title-002.tex}{}
\CatchFileDef{\tzerozerothree}{title-003.tex}{}

On possibility to convert digits into their corresponding words is the numspell package:
\documentclass{article}
\usepackage{numspell}
\usepackage{pgffor}
\begin{document}
\foreach \x in {0,...,9}{
\foreach \y in {0,...,9}{
\foreach \z in {0,...,9}{
\x\y\z : \numspell{\x}\numspell{\y}\numspell{\z}
}}}
\end{document}

In an hour or two, using Emacs, I created a look up table which solved the problem. The English spelling of Arabic numerals appears to be less prone to error than is the use of Roman numerals.

Related

LaTex how to edit this equation?

I'm having issues turning this word equation into a LaTex equation. It's coming out looking dodgy, please help!
I added a screen shot of the equation I want, and what I end up getting when I copy and paste into LaTex:
WORD:
LATEX CODE:
\mathrm{=\ }\mathrm{C}_\mathrm{0}\mathrm{[1-}6(Dt)1/2aπ2-3Dta2] + 12(Dt)1/2an = 1∞exp(na(Dt)1/2)
and therefore nothing comes out and LaTex doesn't let me run it.
This is absolutely not a proper LaTeX equation code. I don't know what you know about LaTeX, but you cannot just copy and paste from Word or any software to you LaTex editor. Plus, you need to provide your full code for anyone being able to help you.
Anyway, running this MWE should work :
\documentclass[11pt, a4paper, twoside]{report}
% ===== PACKAGES DECLARATION =====
\usepackage{mathtools} % Replaces amsmaths + more features
\usepackage{amsfonts} % Maths fonts package
% ===== DOCUMENT BODY =====
\begin{document}
\begin{equation} % optional : use the "equation*" environment to remove equation number
% optional : use traditional math font by removing the \mathrm{} command
\mathrm{X = C_0 \left[ 1 - \frac{6(Dt)^{1/2}}{a \pi^2} - \frac{3Dt}{a^2}\right] + \frac{12(Dt)^{1/2}}{a} \sum_{n=1}^\infty \exp\left(\frac{na}{(Dt)^{1/2}} \right)}
% optional : remove auto-sized brackets by removing the \left and \right commands
\end{equation}
\end{document}
As written in the code, you may want to remove the equation number and the big auto-sized brackets (that are more readable in my opinion). Just remove the corresponding commands. Also, you should consider using the "normal" math font and not the roman one that is clearly different from the text and helps the reader to separate equations from inline small expressions you could insert in your document.
One first sketch:
\documentclass{article}
\begin{document}
\[
C_0\left[1-\frac{6(Dt)^{\frac{1}{2}}}{a\pi^2}-\frac{3Dt}{a^2}\right]+%
\frac{12(Dt)^{\frac{1}{2}}}{a}\sum^{\infty}_{n=1}%
\exp\left(\frac{na}{(Dt)^{\frac{1}{2}}}\right)
\]
\end{document}
No packages required. The output:
Than you can tune the math fonts and anything else.

Formatting of Strings in Latex in whitespace insensitive environment / Z-Notation Schema

I'm using latex to model a few functions using Z-Notation, however, I'm having issues showing a string for output. In this reduced example code, the text in the quotes has a different formatting from what I would expect. What can I use to keep the formatting the text inside the quotes to be the same in the code snippet?
Edit: The overDraftMessage should be messageOutput, missed changing this when creating a reduced example.
\documentclass{article}
\usepackage{oz} % oz or z-eves or fuzz styles
\begin{document}
\begin{schema}{function}
messageOutput!: $STRING$ \\
\where
messageOutput! = ''Output looks strange.'' \\
\end{schema}
\end{document}
Solution from #lburski works, but tilde is not for this purpose. It should be used to make hard space (non-breaking space). To write space in whitespace insensitive environments, you need to escape it - write backslash before every space: ''Output\ looks\ strange''.
If you want a space between the words on your string ''Output looks strange.'' then try putting a tilde '~' between those words. So you string ends up being ''Output~looks~strange.''

Code in latex for braces

In LaTeX text, I sometimes need 'unpaired' parenthesis - ( without ) or vice versa; however, in such a case, delimiter check macro reports error. I found a simple solution: \symbol{40} and \symbol{41}, which aren't recognized as delimiters. The same works for brackets [ and ] (decimal codes are 91 and 93 respectively), but doesn't work for braces { and }. Their codes are 123 and 125 respectively, but \symbol{123} and \symbol{125} produce something like dash and quote. I use fontenc LCY, trying both text and math modes.
I've found a solution:\textbraceleft and \textbraceright, but why \symbol doesn't work in such a case?
Found it! This first code
\documentclass[border=5mm]{standalone}
\begin{document}
\symbol{123} and \symbol{125}
\end{document}
gives
as output, while
\documentclass[border=5mm]{standalone}
\usepackage[T1]{fontenc}
\begin{document}
\symbol{123} and \symbol{125}
\end{document}
gives this output instead:
Adding
\usepackage[T1]{fontenc}
provides the desired font encoding (fontenc package).
A (not-so-further) reading suggestion: font encoding vs. input encoding.

MathJax - Live Preview LaTeX to Unicode

How can I show into MathJax live preview the word "ñ"?
I've tried to insert This latex name Mu\~{n}oz in http://www.mathjax.org/demos/scaling-math/
But the \~{n} is not replaced to ñ
In LaTeX one may use \~ or the Unicode input itself:
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
This \LaTeX{} name Mu\~{n}oz Muñoz.
\end{document}
MathJax is limited, but it does support using the Unicode character as input when you use:
\hbox{This LaTeX name Muñoz}
Note the switch to "text mode" via \hbox.

Latex listings-package format option for uppercase keywords

I use the listings package to insert source code. I would like to print all keywords uppercase in the output, regardless of the case in the input.
The manual states that
keywordstyle=[number][*]style
produces just what I want. However the following (almost) minimal example does not work.
if I set keywordstyle to "[1][]{\bfseries}" I end up with "[]" in front of every keyword
and "[*]{\bfseries}" gives me an asterisk in the start of the document.
I also tried "\MakeUppercase" and "{\MakeUppercase}" for keywordstyle which resulted in several errors, the first being:
! Incomplete \iffalse; all text was ignored after line 11
Minimal example:
\documentclass{article}
\usepackage{listings}
\lstdefinelanguage{KA_assembler}
{morekeywords={add,and,or,xor},
keywordstyle=[1][*]{\bfseries},
sensitive=false,
}
\lstset{language=KA_assembler}
\begin{document}
\begin{lstlisting}
and %r1, %r2
xor %r2, %r3
and %r4, %r5
\end{lstlisting}
\end{document}
I use Miktex for compilation of the tex files. So how do I force uppercase for Keywords?
In the manual, the brackets around the * look a bit different then the brackets around number. The reason is that the brackets around * are not meant to be used in the latex code, they just indicate that the presence of the * is optional. So try
keywordstyle=[1]*\bfseries
or
keywordstyle=*\bfseries
- it worked for me.

Resources