{syntax} is about the principles and construction of the (La)TeX language.

learn more… | top users | synonyms

19
votes
3answers
2k views

Typesetting LaTeX Source Code with the listings package

I am writing some documentation for a LaTeX package, in which I am going to be including some example LaTeX code. What is the best way to typeset that code? I know I could just use verbatim, but it ...
11
votes
5answers
716 views

How do I print a syntax-highlighted LaTeX source file?

I want to print an example source file so that I can study it. How do I print it with syntax highlighting? I'm currently using TeXShop in MacTeX; apparently it doesn't have this ability. What program ...
13
votes
5answers
1k views

Use column-separator & (ampersand) inside \newenvironment

I'd like to define a grammar environment which basically wraps a tabular environment. Inside the grammar environment I'd like to use an environment called production to insert rows. Example: ...
15
votes
1answer
456 views

Are there guidelines on how to read commented sources of LaTeX packages?

I'm trying to read source2e.pdf (texdoc source2e on the command line), but I'm stumped. It seems a rather mysterious tome to me. As I understand from this answer about what arguments a command ...
8
votes
2answers
300 views

How do I split a command into several lines and have LaTeX read it as only one line?

For example, I have a command which has a lot of options: \documentclass[option1,option2,option3,option4,option5,option6,option7]{article} I want to split it to several lines so I could read the ...
3
votes
2answers
454 views

When to use trailing backslashes

I am learning to use the puthesis document class. I have the following code: \documentclass[iupuiece,thesis]{puthesis} \begin{document} \title{The Theory of Everything} \campus{West Lafayette} ...
8
votes
3answers
402 views

A (La)TeX with only one special control character in the source file

One thing I find annoying about (La)TeX is that there are too many special characters. To have any of \ $ % & # _ ~ ^ { } in a text in the document we have to escape it using \. Personally I ...
70
votes
4answers
74k views

When should one use \verb and when \texttt

Sometimes people here use \verb!A SHORT COMMAND! and sometimes \textt{A SHORT COMMAND}. I'm unsure when to use which. Are there any guidelines or arguments for \verbatim vs. \texttt?
36
votes
8answers
3k views

Why do people use unnecessary braces?

I often see people creating new macros where the macro token is surrounded by braces. For example, \newcommand{\foo}{foo} This is unnecessary and I find the extra braces make it harder to read. Why ...
15
votes
2answers
635 views

New language - hyphenation

I'm working in a project (Ubuntu Manual, if you're curious) which requires TeX to create a PDF document. But when we have almost all translated, I've found that there wasn't an hyphenation pattern for ...
18
votes
7answers
4k views

How to convert mediawiki syntax to latex?

I think I've seen a script for converting mediawiki syntax to Latex. Also, in case there are more than one solution for this, it might be nice to summarize them here.
17
votes
3answers
15k views

Reference name of description list item in LaTeX

(Repost from Stack Overflow) I'd like to refer to a description list item by name instead of number. To that effect, I've added labels to each item, but when referencing them I only get the name of ...
53
votes
6answers
12k views

Syntax Coloring in LaTeX

Is there any way to include Python code in a LaTeX file and automatically color its syntax? Is it possible to do syntax coloring with any other language? If yes what packages can I use to do that?
16
votes
3answers
3k views

What is the deal about these semantic vs syntactic commands?

I keep hearing people on this site talking about "semantic" vs "syntactic" commands and that the "semantic" ones are somehow better. I don't really get what they are talking about, could you explain ...
1
vote
1answer
771 views

In WinEdt 6, how do I highlight a block of just typed text with no effect on the compiled document? [closed]

I hope WinEdt6 is recognised as one of the best LaTeX's friends. I write my latex stuff, and when a para is considered done, I want to \done{the completed para text} so that it differ from what I ...
43
votes
2answers
17k views

How should I type author names in a bib file?

Can someone please explain in a clear and concise way how am I supposed to enter the names of authors in a BibTeX file? I have entries with something like @article{someid, author = {Juan A. ...
169
votes
8answers
12k views

Are \( and \) preferable to dollar signs for math mode?

Along the lines of Why is \[ ... \] preferable to $$?, what reasons are there (if any) to favor \( ... \) over $ ... $?
268
votes
8answers
24k views

Why is \[ … \] preferable to $$ … $$?

I've heard that you should use \[ ... \] for displayed equations instead of $$ ... $$, but why is that? I'd assumed that it's so that you can more easily tell which are starting and which are ending ...
16
votes
4answers
2k views

Syntax of TeX/LaTeX

{} and [] do some kind of grouping, and comma seems to be special as well. Being a programmer I find it frustrating to use Latex on incantation-only basis. I would like to know how does it exactly ...