Well, here is a partial answer - does everything, (except I don't know how to output ASCII code as character on terminal in Latex (\char
apparently typesets, and it's not expandable, so cannot be used in \typeout
) EDIT: Fixed thanks to uccode
trick by @DavidCarlisle in comments.), except the "reverse lookup".
(EDIT2: See also the texref
tool (not the package) in comment by @codebeard)
The output is something like this:
...
ASCII [29]: ==^^]== CATCODE {15}: ignored
ASCII [30]: ==^^^== CATCODE {15}: ignored
ASCII [31]: ==^^_== CATCODE {15}: ignored
ASCII [32]: == == CATCODE {10}: space
ASCII [33]: ==!== CATCODE {12}: otherchar
ASCII [34]: =="== CATCODE {12}: otherchar
ASCII [35]: ==#== CATCODE {6}: parameter
ASCII [36]: ==$== CATCODE {3}: math shift
ASCII [37]: ==%== CATCODE {14}: comment
ASCII [38]: ==&== CATCODE {4}: tab
ASCII [39]: =='== CATCODE {12}: otherchar
ASCII [40]: ==(== CATCODE {12}: otherchar
ASCII [41]: ==)== CATCODE {12}: otherchar
....
.. and the code is here:
\documentclass[12pt]{article}
% http://mathematics.nsetzer.com/latex/latex_for_loop.html
\usepackage{ifthen}
\newcommand{\forloop}[5][1]%
{%
\setcounter{#2}{#3}%
\ifthenelse{#4}%
{%
#5%
\addtocounter{#2}{#1}%
\forloop[#1]{#2}{\value{#2}}{#4}{#5}%
}%
% Else
{%
}%
}%
\newcommand{\printcatcode}[1]{%
\ifcase\catcode`#1\relax
escape\or
beginning of group\or
end of group\or
math shift\or
tab\or
end of line\or
parameter\or
superscript\or
subscript\or
ignored\or
space\or
letter\or
otherchar\or
active\or
comment\or
ignored\fi}
\newcommand{\printcatcodeI}[1]{%
\ifcase\catcode#1\relax
escape\or
beginning of group\or
end of group\or
math shift\or
tab\or
end of line\or
parameter\or
superscript\or
subscript\or
ignored\or
space\or
letter\or
otherchar\or
active\or
comment\or
ignored\fi}
\newcounter{ct}
% NOTE: \char *typesets*
% \typeout{\char\thect} doesn't work;
% \char typesets - and doesn't expand!
% to print character from code, use uccode trick
% (with A as standin, only local changes):
%
\def\printCatcodeTableStdout{%
\forloop[1]{ct}{0}{\value{ct} < 256}{%
{% code_block (changes only in local scope)
\uccode`A=\value{ct} %
\uppercase{ %
\typeout{ascii [\thect]: ==A== catcode {\the\catcode\thect}: \printcatcodeI\thect }
} % end uppercase
} % end code_block
} % end forloop
%\typeout{=A=} % check if back to normal? yes
}
\begin{document}
\printCatcodeTableStdout
\end{document}
LaTeX is always run from the command line: An editor simply enters the command for you when you hit the button. Most tex editors will even allow you to customize what command you send.
Given this, you don't need to write your file on the command line. Simply write and save the file as normal. Then open a command line, and go to the directory you saved it to.
>cd C:\Terrible\Sample\Directory
or
>cd /usr/cthulhu/home/terrible/sample/directory
for example. (Odd thing that makes no sense, if you need to change drives on windows, you have to type in the drive name. As in you can do cd D:\Terrible\Sample\Directory
while you are on C: and nothing will seem to happen. Type D:
and boom, you are in the right place on D. So just move drives first, and it is less confusing.)
Another easy way to do this is open your tex file in notepad++. In the file menu it has an option Open Containing Folder
that lets you pick Explorer or cmd. cmd while open the folder with your tex document on the command line for you.
Now you are in the right folder, this is just like opening the file in Explorer or a file manager. Now you need to run LaTeX. The exact commands you need to enter here depend on how complicated your file is. The most basic version to compile example.tex
would be just >pdflatex example
. After this runs you'll have example.pdf
saved in the same folder. Now, if you need to run biber
or bibtex
after that, you do the same thing: >bibtex example
, then run >pdflatex example
again to update the pdf.
Of course, this will change depending on your tex engine: if you run latex
instead of pdflatex
you'll get a dvi, and you'll have to do something else if you use XeTeX or LuaTeX, but it should be similar.
Now, basic PDF? That is quite simple. However, suppose you have a table of contents, a works cited, and are using the lastpage
package? You are going to have to compile a whole bunch of times, probably at least three. This is a pain, so there are packages to do this for you. I know of autolatex
and latexmk
. These compile your pdf, check if there is more work to be done, then run bibtex, compile again, whatever, for you, over and over until it is finished. Now, I've only used latexmk
myself, though I've heard people say autolatex
is better (I just don't want to install Python). To use it you just type >latexmk -pdf example
and it will take care of everything for you. If you don't type the -pdf
it will give you a dvi (You can fix that in the config file, but I've never figured out where to put that on Windows to do that globally. If you are on mac or *nix the manual will tell you that.)
Now, suppose you have an error or are using \show. Your document will start compiling, text will scroll down your screen (if you are on windows always type 'color 2' before starting, then it will look like The Matrix) and then it hits the error or \show and stops. It will then give you some options. I've never used \show, but if you hit an error it will give you two options I know of: x
will kill the compilation now, and you can go fix the error, and r
will tell it to try and compile anyway, which, if it can, will often let you see where the stupid $ you missed is, by making everything after it math mode (or similar.)
Does that all make sense? This is how I often compile my files, and I'm far more of an inexperienced user then most of the people here, so I'm hoping I was able to clarify things.
Best Answer
The
texio
library provided byluatex
provides more control over message formatting and does not insert a space:The result is: