LaTeX is like a language. In order to write LaTeX code I have to understand the "word" and the "sentences structure". I have searched on wiki, some LaTeX books, but they just give the LaTeX command, not how to write a LaTeX code for some specific purpose or to understand the LaTeX code.
Here is one example:
\renewenvironment{svgraybox}%
{\fboxsep=12pt\relax
\begin{shaded}%
\list{}{\leftmargin=12pt\rightmargin=2\leftmargin\leftmargin=\z@\topsep=\z@\relax}%
\expandafter\item\parindent=\svparindent
\hskip-\listparindent}%
{\endlist\end{shaded}}%
%
\renewenvironment{svtintedbox}%
{\fboxsep=12pt\relax
\begin{tinted}%
\list{}{\leftmargin=12pt\rightmargin=2\leftmargin\leftmargin=\z@\topsep=\z@\relax}%
\expandafter\item\parindent=\svparindent
\relax}%
{\endlist\end{tinted}}%
%
}}
%
\let\SVMonoOpt\@empty
I do not know what is \z@
, what is \relax
, what is \fboxsep
… and if I want to design my LaTeX file in my own form, I know that I have to understand many other things.
Note that I can write simple LaTeX enviroment in mathematics (like the matrix, align, enviroment) but it does not help me to understand the above code.
So, what could I do? What book should I read? Or what programming language should I learn?
Best Answer
The TeXbook is the best place to learn about the underlying TeX language, although TeX-by-Topic (
texdoc texbytopic
) in most distributions is a good free alternative. But much of what you show is not directly using TeX primitives but using constructs such as\list
defined in the latex format. The LaTeX Companion has detail for that or the free documented sources of LaTeXtexdoc source2e
has lots of information.This site of course can also be used. For example
on
\z@
What does \z@ do?on list parameters, several answers, e.g., How to create a custom list and \item element?
on
\relax
for example What is the difference between \relax and {}?on
\expandafter
lots of questions, e.g., When to use \edef, \noexpand, and \expandafter? but note the usage in the code you show is in error, it is harmless but does nothing.