I am not an experienced TeX/LaTeX user. I know just about enough to write my thesis. As my interest grows, I'd like to continue improving on my TeX/LaTeX knowledge, more specifically, my "working" knowledge!

On TeX.SX, whenever I see an answer that includes TeX's control sequences, I immediately take a step back! .. and I have been using this community as a knowledge resource for more than 3 years now!

Sometimes I find answers containing TeX's control sequences that let me do exactly what I need to do, but I use them on a blind belief that -

"these guys are pros, they know what they are talking about!"

.. because, I simply don't know enough about TeX's low/middle/high/higher -level control sequences to understand what they've done in their solution.

For instance, I posted a question earlier, to which I got this solution. Many thanks to the person who answered; however, my first impression of it was -

"darn! it contains lot's of pure TeX stuff, so it must be a better solution that what I came up with!"

This experience has made me realise that I need to expand my "working" knowledge about the TeX/LaTeX low/middle/high/higher -level control sequences, if I am ever going to understand what some of these more experienced users are talking about.

So, here's my question again:

How can I improve my "hands-on"/ "working" knowledge of TeX's low/middle/high/higher -level control sequences; so that one day, if required, even I'd be able to use some of these useful TeX/LaTeX tools?

Many thanks in advance!

  • 1
    Well, practise a lot, read the TeX Book and TeX by Topic and don't forget \expandafter etc. ;-) Seriously, your question is a little bit broad, in my point of view – user31729 May 27 '15 at 21:48
  • 1
    Thanks! Perhaps it is a little bit broad than some would like; however, it is really a nagging question and I am sure there are other relatively inexperienced users who have struggled with it as well! .. Well, I can only hope that there are others like myself ! :-) – Amar May 27 '15 at 21:54
  • Buying and repeatedly reading The TeXBook is really a sine qua non for learning plain TeX. TeX by Topic and such are great, but there still is no substitute. – dgoodmaniii May 28 '15 at 0:04
  • Thanks! I expected to see these two books feature here right away! :) – Amar May 28 '15 at 16:26

My first source is TeX.SX! I learned here so much about TeX/LaTeX and macro expansion and still feel sometimes a little uneducated, but it's improving ;-)

However, if there is no precise question (title) on what one is looking for, some manuals are perhaps the better choice.

My main printed source is the TeX by Topic book by Victor Eijkhout, but it's some inspiration on TeX for deeper insights.

(No, I don't own a copy of the TeX Book, I admit it here.)

The principles of TeX can be classified in some categories (as I learned here basically during the last 16 months)

  • The \def, \edef, gdef and \xdef statements for defining macros

  • the notorious \expandafter (or bunch of \expandafters ;-))

  • command sequences itself and constructing them on the fly using \csname foo \endcsname

  • Conditionals such as \if...\else...\fi
  • Registers such as allocated with \newcount, \newdim etc.

  • Low - level file access with file handles generated by \newread and \newwrite as well as \openin, \openout, \closein and \closeout.

Knowing the basic syntax and the principles behind those commands/concepts will provide some clue.

But the most important thing (in my point of view) is practising using problems!

For LaTeX specific issues there are sources on the net as well as the LaTeX Companion or the very topic - related books by Herbert Voss, however, some of them were published in German language only (so far)

  • Thank you for your classification of the basic TeX principles. I shall keep your advice about practising in mind. Though, I wonder why you have mentioned \expandafter separately? I have seen many others talk about it as well. Also, I have seen some TeX commands containing @ ... where do they fit in this classification? Are these one of the TeX primitives? – Amar May 28 '15 at 16:37
  • @Amar: No, the @ commands are LaTeX inventions. I missunderstood your question actually a little bit. I thought you meant plain TeX macros only – user31729 May 29 '15 at 5:04
  • OK. No, there's no misunderstanding on your part. I just took the opportunity to clarify the @-related question here in this discussion. That's all! :) – Amar May 29 '15 at 12:29
  • @Amar: Well, if I had known that you meant LaTeX too, I would have also mentioned source2e and the classes, as Lusr has done, but it's use to edit my code again. – user31729 Jun 3 '15 at 18:08
  • As my previous comment must've already revealed to you that, like most beginners, my awareness regarding the thin line that separates TeX & LaTeX control sequences is admittedly and shamefully quite inadequate! :-| While your answer showed me a rough hierarchy of TeX commands, Lusr56's answer suggests some of the ways in which, I may go about studying some well-established examples of TeX/LaTeX code. In their own unique way, both answers not only provide valuable information, but also complement each other in terms of the learning process. Cheers! :) – Amar Jun 3 '15 at 18:31

From my experience as an end usr, and not a pro developer, I would say you are on the right track: first, find a need (something you need), and then try to write a package to solve that need. In the process check reliable documentation (I often perused source2e.pdf and the source code of the base LaTeX classes.pdf, all available at the base directory of CTAN, and documentation for the basic tool packages of the system, which are pretty good examples of TeX programming and have lots of clever hacks specific to LaTeX; then check Abrahams, Berry, and Hargreaves's TeX for the Impatient, which is pretty to the point, as often as you need it while reading the source code, to figure out things about TeX's kernel primitives; and perhaps also read the documentation for your favorite engine -mltex, etex, pdftex- to see the particulars of their implementation). Finally, ask relevant forums (comp.text.tex is less stressful than SE, imnsho). Hacking is like poetry: first you sing others' songs; then you copy a lot; finally, you may start to sing on your own.

  • I liked your idea about following source2e.tex! .. What do you mean by "source code of the base"? How do I find out which files or packages are part of the "base"? – Amar May 28 '15 at 16:54
  • 1
    @Amar I mean, «the source code of the basic and tools (did I say "required"? Sorry!) latex classes and packages», e.g. article.cls, 11pt.clo, enumerate.sty etc., which come in every LaTeX distro to be considered complete. And also read the also distributed "LaTeX for authors" and "LaTeX for Class and Package Writers". That should give you a fresh start in LaTeX hacking. – erreka May 28 '15 at 17:59
  • 2
    @Amar follow the links to the base and tools essential to latex; and the "minimal documentation for authors and class and package writers". – erreka May 28 '15 at 18:09
  • 1
    I do know how this site works! :P But, your comments were more useful than the original answer and I have already upvoted those. I would've upvoted your answer right away if it contained at least some of the information from your comments. In any case, I reserve the right to upvote an answer or otherwise, irrespective of anyone's persuasion. – Amar May 28 '15 at 19:00
  • 3
    @Lusr56 +1 for “find something that you need”. I think that’s really key to create an interest and motivation to learn programming (or anything else, for that matter). – Arthur Reutenauer May 28 '15 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.