7 ms·
For some reason, a lot of articles about LaTeX focus, like this one, on typographic features such as ligatures and line breaking. For me, where TeX earns its k
by dmlorenzetti 16y ago
For some reason, a lot of articles about LaTeX focus, like this one, on typographic features such as ligatures and line breaking. For me, where TeX earns its keep is the macro capability. While primitive as a programming language, the ability to define your own commands is a powerful tool for enforcing consistency and reducing effort.
Two examples from work. For a proposal, we had to produce two documents, a short and a long one, with common titles and introductory paragraphs and cross-references and such. With LaTeX, we actually wrote just one proposal, with the contents embedded in TeX macros. Changing the macro definitions let us produce what became two "views" of the same material.
Second, for a paper on sorption modeling, we used macros for all the physical variables, to make sure all the equations "read" correctly (e.g., writing "\cSorbBulk" rather than, say, "C_b"). Halfway through the paper, we decided on a new notation for distinguishing between gas- and sorbed-phase concentrations. It took maybe five minutes to update the pertinent definitions and re-set the paper.
- JadeNB 16y agoThis is an excellent point. For me, the word change on your first line is what really demonstrates it: many people conflate TeX and LaTeX, because LaTeX is TeX; or, to put it less controversially, LaTeX is written in TeX (rather than other (wonderful) extensions, like PDFTeX, XeTeX, or LuaTeX, all of which require source-level changes). LaTeX 3 (http://www.latex-project.org/latex3.html http://www.latex-project.org/latex3.html) takes this even further—and all this drives home the point (which I hope I may safely assert here as fact) that it's often much better to start with a simple programming language and customise it to your need, than to have a high-level programming language painstakingly customised and tuned for an application that turns out to be two millimetres to the left of the one that you actually want.
- crazydiamond 16y ago>it's often much better to start with a simple programming language and customise it to your need, than to have a high-level programming language painstakingly customised and tuned for an application that turns out to be two millimetres to the left of the one that you actually want. I am interested to know if you had other examples in mind when you said this. Disclaimer: not trying to start a discussion on languages, or lang war.
- JadeNB 16y ago> I am interested to know if you had other examples in mind when you said this. Disclaimer: not trying to start a discussion on languages, or lang war. I'm not sure why you'd want to disclaim trying to start a discussion on languages; it seems like a good thing. The sentence I wrote was originally intended just to describe TeX, but it seemed to me in retrospect that it applied almost as well to Lisp. Although the design philosophies of the two languages are completely different, both are intended to be the foundations for lots of little languages; Knuth has said that he was always surprised that people were happy to settle so quickly on TeX and LaTeX, rather than creating and selecting among many more specialised dialects. (Of course, a quick glance at CTAN shows that it is folly to think that everyone who uses TeX or LaTeX does the same thing with it!) I posted some more examples of highly customisable little languages at http://news.ycombinator.com/item?id=1535807 http://news.ycombinator.com/item?id=1535807, but I should mention that I haven't used them.
- jonsen 16y ago"late x": unknowns late in the process ;-)
- HilbertSpace 16y agoThat's why I use TeX. I understand it fairly well, have a lot of macros that work well, and can write more macros easily. So I have own macros for table of contents, cross references, numbering figures, tables, chapters, sections, theorems, etc., bibliographic entries, verbatim, putting text from TeX on figures, putting a frame around foils, lists, etc. With LaTeX, (1) I would have to learn more and (2) to write macros, I might have to understand and then fight what LaTeX assumes. Also the LaTeX documentation is much larger than 'The TeXBook'! So, I just stay with TeX. Also for me a big, HUGE, point is that input to TeX (or LaTeX) is just a simple 'flat ASCII' text file, and for those I use my favorite, programmable text editor, the same one I use for writing software, e-mail, and much more. E.g., when I need to do some special thing to a TeX file, I can write an editor macro to do it. Net, in my general purpose, long lasting collections, I have about 150 macros for TeX, about 150 for my programmable editor, and about 100 for command line scripts. So, that's 400 names to remember? No, from my editor, I can quickly see all the names of all the macros and, of course, for each macro its source. Searching for macros? My editor is great at searching! Lacking anything else, I can quickly pull all the macros of one collection into one temporary file and just search that. I have no difficulty finding macros! Works well. Not to be missed, I run TeX from a scripting language which is 'smart' enough to do the converstion to PDF, etc. So, I minimize clicking. It's easy: I just have a little text window, and to see the results of a change in my TeX input I just hit the retrieve key in that window and then Enter. It's FAST. Broadly I like 'windows', lots of windows, even for just one piece of work. So, for TeX I will have at least three, one for each of my text editor, the TeX DVI preview output, and the command line scripts. For my current software project, putting a Web site in front of some of my other software, I have about 15 windows with a mixture of Web browser windows and my editor windows. To open all those windows at the start of work, I have a simple script. To arrange the windows, I have a simple script. When the windows on the screen get to be a mess, I have a simple script that will arrange them and can be executed with an icon on the UL corner of my screen. Lesson: One 'application' that has just one window and tries to do everything within just that one window is less good than just using the ability of the operating system to display many windows. So, right, "Look, Ma, no IDE!". And no Word, either. End of my contrarian view of graphical user interface!
- eitally 16y ago
- marktucker 16y agoI agree. While I enjoy that it just makes everything look OK (since I don't care about most of the details), the best parts are the super easy macro definitions and being able to write equations (almost) as fast as I could by hand since it's all text -- I took notes for my physics and math classes in latex. Awesome packages like PGF/tikz, beamer(!) and listings are icing on the cake. Then again, the error messages are abysmal and placing tables is a huge chore.
- tome 16y agoThe macro ability is useful, but painfully leaves much to be desired. The scoping rules are incredibly primitive and there's no namespace functionality. However, you can curry macros! How funky is that?
- HilbertSpace 16y agoTeX itself has a really nice 'architecture' for a 'stack' with dynamic storage allocation and scope of names.
- tome 16y agoCan I access this in LaTeX in any friendly way? What I want to do is replicate the namespace features of modern dynamic languages, so I can "import" macro names into files, and then collate this collection of files somehow to produce the whole document, in a way that doesn't lead to name conflicts.
- HilbertSpace 16y agoTeX starts with a collection of macros called Plain.TeX that get written out in 'binary' so that they load quickly. 'The TeXBook' essentially assumes Plain.TeX. As I recall, for LaTeX, there were some tweaks to Plain.TeX, and I don't understand the tweaks. There is a chance from the tweaks that some of the scope of names in TeX and LaTeX are different. But, for scope of names, essentially as in a 'namespace', or as in name scoping in, say, PL/I or Algol or OOP languages, TeX has that done nicely at least for just one macro at a time. So, if bring in a macro, then need not worry about names within the macro conflicting with names outside the macro. Among the macros I wrote are some for dynamic allocation of storage of the various types within a macro. For more, long names are permitted so that could use those to identify a 'package' or 'namespace' of many macros that call each other. For more, I'd have to get out 'The TeXBook' and read again! The bad news for me is, I wrote the macros a long time ago so do not remember all the details. Indeed, what I wrote for verbatim was darned tricky, and I'd need two hours just to understand the crucial points in those. But 'The TeXBook' is plenty readable. For some questions, can write some little tracing and printing macros (I did) and use the TIFO method, try it and find out. Broadly, though, it does appear to me that Knuth was mostly thinking about one author with mostly their own macros and was not thinking about some world wide 'distributed' document and software development with a world wide name 'registration hierarchy', etc. In particular, if I were to send you some of my work with TeX, what could I send? My TeX input file? Darn, that assumes my full macro collection, and I wouldn't want to bother you with that. So, send you a DVI file? That assumes that you have the same font collection I do, and just what that is is not always so clear. So, net, the easiest thing to send is just a PDF file that has the font definitions inside the file. Broadly, then 'group' work was not a big design priority. I have a friend, a good mathematician, who won't touch TeX and keeps running it down. Some of his criticisms are valid. E.g., look at 'The TeXBook': Essentially just one color. On each page, usually just one column. No page to page cross references. Not much in graphics except where the pictures are on their own pages, e.g., at the beginnings of the chapters. Positioning pictures to be close to corresponding text is a pain (unless there are some fancy macros I don't know about). Just how to get running headers and footers more than just simple single lines a bit tricky to understand. Something of a pain unless just use the Computer Modern fonts and the AMS symbols and a few more, e.g., the Euler fonts good for more math symbols. The glory, then, is in what TeX does with mathematical expressions, and there it's just terrific: Just type in stuff, and immediately or soon it looks great. And surprisingly complicated expressions still look great just 'in line' instead of in 'display mode'. I do wish there were more sizes of brackets, etc.! In my career in math, by far, I mean FAR, FAR^10, the most difficult problem, WAY more difficult than anything else, was JUST getting the math typing done. The math itself, for my Ph.D. dissertation, my published papers, my technical papers, was always MUCH easier than just the typing. The typing for the math was HELL. TeX solved that problem -- now I can do some math, type it in, and have something looks good right away. My main complaint is just that the Computer Modern fonts look WAY too light in PDF. If someone wants to do another TeX, fine with me. In the meanwhile, for me, TeX makes high quality word whacking a solved problem so that I get to concentrated on other things.
- kmfrk 16y agoThat's true, but I usually regard articles or posts like these as sales pitches for LaTeX to people who use Office or something similar. They may not mention the best features, but they are possibly the sexiest to people new to LaTeX. Having said that, I'd love to see more articles emphasizing the feature you are praising. Different audience, different sales pitch.