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

learn more… | top users | synonyms

4
votes
1answer
312 views

listings wrong syntax highlighting in perl - format specification

Perl uses '#' as an introduction for a comment, but also as a format specification. This produces problems in the syntax highlighting in the listings-package. How can I fix it? ...
-1
votes
1answer
363 views

Smalltalk syntax highlighting for Latex [closed]

What is the easiest way to format Smalltalk syntax using the listings package?
0
votes
0answers
65 views

what does an asterisk (*) character do in a renewcommand? [duplicate]

Possible Duplicate: What's the difference between \newcommand and \newcommand*? I've seen * used in memoir.cls: \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily} and ...
4
votes
1answer
155 views

What is the proper way to format syntax within ConTeXt?

For some time, I have thought, perhaps mistakenly, that the precise placement or spacing around ConTeXt syntax was unimportant, e.g., under this assumption, all of these should produce the same ...
7
votes
1answer
367 views

Different syntax for nodes with pos=x on a path with (A) — (B) and (A) to (B)

I wonder why we need a different syntax for specifying nodes (and coordinates) on a path when using the simple -- and the .. controls … system or the to operation. Here’s an example to illustrate the ...
5
votes
1answer
454 views

How to enclose terminal symbols within circles and/or nice oval boxes in a syntax diagram built using syntax.sty?

I hope you can help me again. I want to use the syntax package to build syntax diagrams, but I want to enclose non-terminal symbols in boxes and terminal symbols in circles or well-formed oval boxes ...
2
votes
1answer
199 views

Looking for macros to typeset syntax in more conventional way

I want to create a note about PSTricks and I need macros to typeset syntax in more conventional way that is adopted by most computer scientists. For example, I need a pair of > and < but they ...
2
votes
1answer
288 views

Syntax: De-highlighting Certain Commands in TexShop

There seem to be commands of various quality. A command like \section has some structural effects and differs considerably from commands like \dots or author-defined shortcuts (for example \eg for ...
7
votes
1answer
1k views

How do I get colorized syntax highlighted code in pdfLaTeX

I'd like to get syntax highlighted code in LaTeX, but want to preserve the monospaced font (no curly quotes either). pygments doesn't seem to have an option to avoid curly quotes that I could find. ...
2
votes
1answer
913 views

Using “listings” package to colorize the source code of ANTLR grammar file?

I use listings package in my diploma thesis for source code. Besides the mainstream languages like Java and C# I also need to include the sources of the language grammars (.g) which are pure mark-up ...
26
votes
3answers
3k views

What is the difference in citing/referencing with or without tilde?

I've seen examples referencing a table as follows: Table~\ref{table:overview} shows an overview of all the elements. What is the use of the tilde in front of \ref or \cite and when do you have to ...
16
votes
3answers
708 views

Short version of emph?

Is there something like a short version of \emph? What I want is something comparable to \lstShortInline or what the shortvrb provides, just not for the \verb command but for the \emph command ...
1
vote
3answers
460 views

Syntax doldrums

I am a long time user and fan of LaTeX, but I hate the syntax! I wish it could be more like Python or Haskell. The syntax of those programming languages is much more readable than LaTeX which is ...
6
votes
1answer
367 views

What does a number followed by “ in” mean?

The TeX syntax highlighter that I use colors all occurrences of a number followed by " in", e.g. 0 in or 32 in in a dangerous bright red, in almost all contexts. Why?
2
votes
1answer
3k views

A package for formatting Linux terminal excerpts?

I know about minted and listings, but either of those are intended for formatting of programming languages excerpts. Is there a package that would do the same for Linux terminal excerpts? Such as: ...
7
votes
2answers
5k views

Is there a way to enable syntax highlighting coloring in Lyx for program listings?

I want to embed a small program listing and have used Insert -> Program Listing in LyX's menu for that. The settings dialog supports selecting a language (Java), but I can't actually see any ...
2
votes
2answers
967 views

TeXShop foreground color can't be set to desired default

Among the IDE's I've tried, TeXShop wins it for me as of now. Except for a small but very important customization: setting the foreground color. I dig through ~/Library/Preferences and find ...
3
votes
2answers
2k views

How to set indentation within grammar environment?

I'm using mdwtools and syntax package to write BNF grammar, I wonder is there a way to set the parindent so that each production line will be center algined instead of left aligned by default? ...
18
votes
3answers
8k views

Which package can be used to write BNF grammars?

I googled and found two packages: mdwtools bnf Unfortunately, both of them have extremely poor documentation. There are only one to two examples for each one, which makes it hard to follow. ...
9
votes
2answers
2k views

Why \land instead of \and?

I recently asked the logical and character in TeX and got \land as the answer. My question is, why \land, and why not simple \and? I mean, does l here refer to something technical, or historical, or ...
15
votes
3answers
14k views

Logical “and” character in TeX

I'm trying to write a logical syllogism in the form of ((a -> b) & (c -> a)) -> (c -> b). But I don't know how to write Logical And character. It's something like caret character (^), but not as a ...
77
votes
4answers
2k views

Techniques and packages to keep up with good practices

Question What techniques and packages are there to keep up with good practices? What I already know I already know of the following packages for this kind of purpose: ...
6
votes
2answers
1k views

Is there a LaTeX package to format computer language grammars?

I need to display BNF grammars, but couldn't find any LaTeX package that does this.
15
votes
3answers
1k views

How to add custom C++ keywords to be recognized by Minted?

I have defined several structures and types in a C++ project. I have to write some documentation for this code, and I use the minted package to typeset my code. I would like to be able to add some ...
9
votes
3answers
2k views

Ruby highlighter for LaTeX

I'm looking for a package that can highlight ruby source code in LaTeX. I've found this thread: http://stackoverflow.com/questions/1966425/source-code-highlighting-in-latex But it is from 2009, and ...
5
votes
3answers
2k views

Using keywords including a dot in the name with the listings package

I am using the listings package which works like charm in most cases. I tried to define new languages for my needs with the help of morekeywords options in \lstset, but entering special keywords ...
5
votes
2answers
459 views

lineno and syntax package incompatibilities

I'm using the syntax package from the mdwtools version 1996/05/17 1.07. I successfully set the properties to show a grammar definition properly but then when I try to combine it with the lineno ...
10
votes
2answers
3k views

What is the difference between \fboxsep=1cm and \setlength{\fboxsep}{1cm}?

Question has been written above.
138
votes
4answers
6k views

What is the use of percent signs (%) at the end of lines?

I see that the code in many packages and examples contains percent signs % at the end of (many) lines. What are they used for? Do they affect the parsing of those lines?
16
votes
4answers
2k views

How to make a real backslash (escape) character?

I just want a good way to make a backslash character (or whatever character(s) any given format uses as escape characters), suitable to \write to a file or pass to a pdfTeX primitive. Let me ...
44
votes
5answers
47k views

How to escape the & (ampersand) character in BibTeX?

I would like to put a & character in a BibTeX publisher tag. Thus far I have tried: \& {&} {\&} "&" with the full value enclosed in curly braces and double quotes. No matter ...
3
votes
1answer
1k views

Where is \textunderscore defined ?

I just started TeX recently and I'm reworking a legacy TeX-piece (book , second edition). I create lots of TeX-tables (with SAS) and do \input them. The tables contain many \textunderscore s. All ...
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
645 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 ...
10
votes
4answers
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
438 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
279 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
438 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
373 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 ...
56
votes
2answers
48k 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?
34
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
597 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 ...
17
votes
7answers
3k 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.
16
votes
3answers
12k 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 ...
51
votes
6answers
11k 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
2k 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
702 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 ...
33
votes
2answers
13k 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. ...
153
votes
8answers
9k 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 $ ... $?
231
votes
8answers
18k 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 ...