11

I know this is sort of off-topic and may get closed for being opinion-based, but I haven't found what I need by browsing the LaTeX project site so maybe, before the question gets closed, I can get a pointer or two or a link or two.

I've been using LaTeX for quite a while at a pretty basic level. Now I'm getting more proficient and am slowly learning things as I write and format a book. But I feel like there is a gap in the references that I can't fill.

There are lots of materials for beginners. How to do basic formatting, make lists, basic bibliography and so on -- some of these have been enormously helpful to me while learning. Then there is a whole level beyond me -- where people program things, make their own environments, make up new stuff of various kinds.

e.g. I found very helpful code for flexlabelled in the documentation for memoir and modified it very slightly to get:

\entry{word}{pronunciation}
      \begin{flexlabelled}{sclabel}{0pt}{0.5em}{0.5em}{*}{\leftmargin}
       STUFF
      \end{flexlablelled}

But now I am thinking it would be good to have the pronunciation in a different size. I know I could ask that here and some helpful person would answer, but I want to know how I would learn to do that without help.

Or, how do I know what commands can only go in the preamble, what can only go in the main body and what can go in either place?

In the documentation for memoir it says

More major changes to a description-like list will probably involve writing the code for a new environment.

OK, I can recognize that no package is going to do everything I want (although memoir does a LOT) but ... How does one learn to "write code for a new environment"?

But ... I don't know how to learn that. I also don't know how to figure out what goes in square brackets, what goes in braces or what needs neither.

EDIT in response to comments.

What I know: I know how to use LaTeX to write fairly straightforward documents. I know (usually) how to find a good package. I know how to do "normal" things that are covered in books such as "More math into LaTeX" or "Guide to LaTeX".

What I want to learn: e.g. If I want something formatted in ways that need a new environment, how do I do that? How do you know what goes in the preamble vs. main body? How do you know what goes in braces, brackets, parentheses or doesn't need either?

Maybe what I want doesn't exist in a book.

  • 5
    I find using the search feature on this site to be one of the best resources available for learning "how to" regarding LaTeX. The hardest thing is sometimes coming up with the proper keyword to search on. – Steven B. Segletes Apr 21 at 10:42
  • 2
    Know how to use the \section{} command, for example (naive user level), is very different to understand how it works behind the scenes, using many others commands (programmer level). If you really want to pass to this level, start learning the basic commands (TeX primitives) in which all the others commands are based. Only then think about latex 3, lua language, etc. But if you understand that LaTeX is a macro language and \newcommand is great, one can be really creative without this steep learning curve. – Fran Apr 21 at 17:08
  • 3
    One method that I use regularly when I need to 'program things' is to read package manuals. Many of them have a full source code listing in the end, and some of those are extensively explained by paragraphs of normal text in between parts of the code. Once you understand what the code does, then you can make changes. – Marijn Apr 23 at 12:31
  • 1
    I'm not familiar with memoir nor flexlabelled, so I'm not sure what your example is showing. Is that how you use the slightly modified command? Is \entry defined to be that flexlabelled environment? I feel like your question could be summarized as "How do \newcommand and \newenvironment work?" Your question is a lot of opinion-based "how do I learn all of LaTeX", but there is a nugget of "how do I create new commands and environments" that might be answerable. But I'm having trouble understanding what you already know, and what you don't. – Teepeemm Apr 23 at 16:44
  • 3
    We have a similar question here: Where do I start LaTeX programming? with plenty of good advice. – Alan Munn Apr 24 at 14:33
21
+25

Imho "I want to know how I would learn to do that without help" is the wrong starting point. As is the idea that you only need the right book.

I have read over the years many books and texts and references about TeX and LaTeX, and doing this is certainly important. But I learned most by interacting with people, with people better than me at LaTeX who answered my questions, or contradicted me, or corrected my code, and with people I helped by explaining things or by correcting their code or by developing some commands or environments. Learning from, with and through people is very effective. It forces you to put your thoughts into words the other person can understand, it forces you to really read some code or documentation, it forces you to test your knowledge. People can point you to the small important detail that you would simply miss in a large book.

There is currently the idea floating around that teachers in schools and sites like this only exist because the (digital) learning material isn't good enough yet; that with better tablets and books and training material you actually don't need human teachers. I do find this idea quite absurd.

| improve this answer | |
  • 1
    This. A thousand times this. – Alan Munn Apr 28 at 13:48
  • I think you mean 'ridiculous' where you wrote 'hilarious' – Jonathan Komar Apr 30 at 5:25
  • @JonathanKomar no, ridiculous doesn't sound right. I changed into absurd. – Ulrike Fischer Apr 30 at 6:38
  • It's a very stupid idea that has been around for a long time. The learning mechanism is largely based on the identification that takes place between the learner and the teacher. I don't think it's very healthy for a learner to identify with a machine, as sophisticated as it is. – gigiair Apr 30 at 8:25
7

How can one learn 'Advanced LaTeX' effectively?

I was not sure what exactly the main point of your question was - how can you learn to get better at LaTeX or answers to your specific questions.

I will answer the first question because it is one I am asking regularly on my blog.

In fact, I have made the same observation as you that there are tons of materials for complete beginners, yet no materials for learning (what I call) 'Advanced LaTeX'. In fact, there isn't even any "curriculum" for it or a definition of what 'Advanced LaTeX' even means or comprises.

Learning from references or documentation is not didactically efficient

It seems from your description that you are not necessarily someone with a strong programming background. It is my opinion that altogether different learning materials are needed when a programmer wants to learn advanced LaTeX as opposed to someone without that background wanting to learn advanced LaTeX.

Many existing sources are documentation and reference-style materials. However, it is a known fact from didactics that this is not how people learn. Of course, many people have learned from documention and references but it is tedious and not very effective. If you're not used to reading these types of documents, you can easily get lost and frustrated. They're more apt for advanced users with a strong programming background. I would not advise you to use such resources at first, especially if you're not planning on investing tons of time.

A progression for you might look like this:

  • First try out small projects tweaking things to see whether you really want to learn more advanced LaTeX.
  • Find out exactly what it is you want to learn and search for information on such issues specifically. Reading documentation or a whole book often means you'll read lots of material which is currently irrelevant to you - it might not even make sense to you at this point if it's too dense.
  • Once you have gone through your fair share of bite-sized tutorials, then you can start reading more 'global' materials like The TeX Book.

Resources

I am trying to provide materials to help with the issue on my blog. You might also be able to find starting points on Overleaf's tutorial page which is very good.

The blog category on my blog is here: LaTeX Ninja | Advanced LaTeX and here is a post on what Advanced LaTeX could even mean. However, I definitely still have lots of materials to add for this to be a true guide to learning advanced LaTeX; it's still a work in progress but I am always happy to get suggestions on what I should tackle / explain next, so feel free to get in touch.

For now I think the Overleaf resources really might be what you're looking for.

| improve this answer | |
  • ooh a ninja :) – Paulo Cereda Apr 28 at 9:30
  • Your blog looks very useful! Thanks – Peter Flom Apr 28 at 10:29
  • 2
    Could you reduce the use of bold fonts in your text please? I tried three times to read the text in context and didn't manage as the bold stands out so much that it distracts me constantly. – Ulrike Fischer Apr 28 at 11:08
  • done ;) (a while ago already but forgot to comment) – LaTeX Ninja May 20 at 11:41
6

Disclaimer: I am currently at quite a similar point like you, so I do not claim authority on anything I say. You've been warned!

That being said, one thing I guess to be essential is a working knowledge of plain TeX, which I found here. Already pointed out in the comments, there is a virtue in just using tex.sx, because that way you also learn about best practices and it's a learning-by-doing kind of approach, which has so far not let me down in the programming world.

That should give you the equipment to dive deeper and look at package docs for two kinds of things:

  • documented source code, such as in tabularx, where the author explains what he did and why.
  • packages aimed at package authors, such as etoolbox or xstring, that will be helpful by providing you the tools to write packages and examples of how to use these tools.

Apart from that, I wouldn't know of a clearly mapped path towards learning how to use the full underlying power of (La)TeX. There are things like the clsguide, which I have not read and can neither negate nor confirm its merit.

In regards to your closing questions my answers would be:

  • curly braces: mandatory arguments (and groups)
  • square brackets: optional argument
  • doesn't need either: technically the first argument to any command, or even more complicated stuff from plain TeX, I'd say for understandable code just don't use it, but that's my $0.02
  • preamble: anything related to styling
    • better yet: reusable styling into packages (if you are at that point)
    • and the preamble should only contain commands that you need for this specific document, e.g. format tweaks or abbreviations.
  • main body: only contents
  • how to write a new environment: look at examples and patch some commands together until you no longer know how to fix TeX's weirdness. Then visit tex.sx and get help. Repeat until it does what you want.

PS: One of my takeaways of the plain TeX guide I linked above is that TeX is a really weird kind of language (the only turing-complete macro that comes to my mind), which is why I have chosen not to do in TeX what can better be outsourced, e.g. creating graphs. I do take the price of things like typefaces not being consistent but take as a bonus that I can precompile stuff, which speeds up document compilation quite a bit if you had multiple PGF-based plots.

| improve this answer | |
5

The real eye-openers happen when focusing on how each character in your text file are processed (one by one). You'll get to know why you get these obscure, terse, (dare I say, unhelpful) errors. This has to do with the fact that the system was written a long time ago when systems had to be careful how many bytes they use.

  1. Learn how to use the command line program texdoc to have access to all PDF documentation in TeX Live

enter image description here

  1. Read texdoc latex2e

    how do I know what commands can only go in the preamble, what can only go in the main body and what can go in either place?

    • see chapter called, Modes

      If I want something formatted in ways that need a new environment, how do I do that?

    • see chapter called, Environments

  2. Read texdoc source2e

  3. Read texdoc xparse from the LaTeX3 Project.

  4. Read The TeX Book by Donald Knuth

  5. Read Victor Eijkhout’s TeX By Topic (admittedly, I have never read it)

  6. Take advantage of this site regularly.

The most helpful for me was the community at tex.stackexchange.com and learning programming. I had no idea of the relevance of terms like "recursion", "stack", or "LIFO", "FIFO" when I started. Hint: Loops in TeX are done with recursion (even if the LaTeX cover hides that from you). You learn as you go. The inspiration for me were all of the nice-looking (like really sharp) TikZ images and the fact that dissertations written in LaTeX look waaaaay better than those in Microsoft Word.

| improve this answer | |
  • 7
    Please remove or revise point 4. Although it is convenient to have a pdf copy of the TeXbook available, it violates the copyright requirement and also Knuth's explicit request that the TeXbook should not be compiled without explicit permission. (This is at the top of the file texbook.tex, which is included in TeX Live and on CTAN.) The pdf file linked here does not have Knuth's permission. – barbara beeton Apr 25 at 17:27
  • 1
    @barbarabeeton Done. – Jonathan Komar Apr 25 at 17:48
  • 4
    Although it's not really directed at total novices, Victor Eijkhout's "TeX by Topic" is readable online and is also on CTAN and in TeX Live. It's a reference as opposed to instructional, but covers everything in the TeXbook. – barbara beeton Apr 25 at 19:04
2

I am trying to figure out the same, how to do formatting for a book, so far I have done only article format. I can share how I approach it. I use a book template in a TeXstudio, as File > New From Template > Book. Then using LaTex tab in the menu to insert sections, as it is already gives me the key words and brackets automatically. The ways I am learning latex: first of all have quick skim through documentation to get a big picture, then try a few things myself; secondly I type questions in the Google directly which is more likely to point me to this forum, which I find reliable, but it does quicker and more to the point, and you don't have to wait for an answer and can carry on working; and thirdly I type the questions in YouTube and skim the videos, it is more time consuming, but sometimes it worthy. I more likely follow answers of academics or people talking about maths, as those sources in my experiences have more information and they are of better quality, especially for the beginners. I haven't found one reliable, complete and easy source for all though and I don't think that there is one, at least in this moment in time. I am trying to ask Google for one very narrow little question at the time to get better quality answers. In general, all the packages going on the top of main.tex file, then all the headings of the cover like page and some metadata, then all the instructions of the body of the work, then bibliography. In each chapter file - the instruction with name of the chapter on the top, then plain text with optional insertion of subsections, lists, tables and other elements. All the best. P.S. I found a brilliant solution at https://elegantlatex.org/en/ , please have a look, it may solve your problem so far and give you a good start.

| improve this answer | |

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.