GeneralResources for Understanding of Macro Packages

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Resources for Understanding of Macro Packages

Post by ghostanime2001 »

What are some good resources for understanding the command definitions in LaTeX packages? For example understanding commands in a definition such as this:.

Code: Select all

\makeatletter
\def\vectfill@{\traitfill@\relbaredd\relbareda\fldr}
%\end{macrocode}
 %Construction of the arrow:
 % \begin{macrocode}
 \def\traitfill@#1#2#3#4{%
 $\m@th\mkern2mu\relax#4#1\mkern0mu%on met \relbaredd au d\’ebut
 \cleaders\hbox{$#4\mkern0mu#2\mkern0mu$}\hfill%remplit avec relbareda
 \mkern0mu#3$%
 }
Last edited by ghostanime2001 on Fri Jun 14, 2013 7:15 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Resources for Understanding of Macro Packages

Post by Stefan Kottwitz »

Since LaTeX is based on TeX, it's the best to know some TeX for understanding such macros. There are books about it, also free ones.
Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Resources for Understanding of Macro Packages

Post by ghostanime2001 »

I think you mean "Knuth" as TeXbook because there is no PDF file from the link that you provided. Also is there a way to make this definition into a \newcommand macro? I would like to use several customized macro for different settings.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Resources for Understanding of Macro Packages

Post by localghost »

ghostanime2001 wrote:I think you mean "Knuth" as TeXbook because there is no PDF file from the link that you provided. […]
The TeXbook is a commercial book which you have to pay for to get a (printed) copy. So let me list some other useful resources regarding TeX.

Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Resources for Understanding of Macro Packages

Post by Stefan Kottwitz »

Easy \defs can be made to \newcommand, such as

Code: Select all

\def\traitfill@#1#2#3#4{...}
to

Code: Select all

\newcommand*{\traitfill@}[4]{...}
The syntax is a bit different and \def is more flexible.

Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Resources for Understanding of Macro Packages

Post by ghostanime2001 »

how would I define several versions of this code with length parameters into several macros? the only way I know is with \newcommand but substituting this code messes up.

Code: Select all

\makeatletter
\def\vectfill@{\traitfill@\relbaredd\relbareda\fldr}
%\end{macrocode}
 %Construction of the arrow:
 % \begin{macrocode}
 \def\traitfill@#1#2#3#4{%
 $\m@th\mkern2mu\relax#4#1\mkern0mu%on met \relbaredd au d\’ebut
 \cleaders\hbox{$#4\mkern0mu#2\mkern0mu$}\hfill%remplit avec relbareda
 \mkern0mu#3$%
 }
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Resources for Understanding of Macro Packages

Post by cgnieder »

This is a follow-up or related question to your other question about the redefinition of the esvect arrow, right?

I must say I don't really understand what goal you're after in the end. Maybe you can elaborate on what the final code should be able to do. Then it would be easier to give specific help.

Regards
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Resources for Understanding of Macro Packages

Post by ghostanime2001 »

That is correct
This is a follow-up or related question to your other question about the redefinition of the esvect arrow, right?
My goal is to do exactly that in the link to my post. What does \traitfill@ do?
Post Reply