{syntax} is about the principles and construction of the (La)TeX language.
4
votes
1answer
136 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 ...
5
votes
1answer
243 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
287 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
167 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
212 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
406 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
455 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 ...
16
votes
3answers
990 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
592 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
342 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 ...
4
votes
1answer
249 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
1k 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:
...
2
votes
1answer
2k 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
652 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
760 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?
...
10
votes
3answers
3k 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. ...
5
votes
2answers
867 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 ...
7
votes
3answers
2k 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 ...
69
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
614 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.
12
votes
3answers
624 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 ...
8
votes
3answers
1k 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
1k 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 ...
4
votes
2answers
375 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 ...
9
votes
2answers
2k views
What is the difference between \fboxsep=1cm and \setlength{\fboxsep}{1cm}?
Question has been written above.
84
votes
4answers
2k 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?
12
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 ...
20
votes
4answers
22k 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
577 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 ...
18
votes
3answers
1k 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
513 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 ...
7
votes
4answers
874 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:
...
14
votes
1answer
363 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
253 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
398 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
298 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 ...
36
votes
2answers
14k 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?
31
votes
8answers
2k 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
498 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 ...
11
votes
6answers
1k 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.
11
votes
3answers
6k 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 ...
44
votes
6answers
7k 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?
15
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
523 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 ...
19
votes
2answers
5k 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. ...
119
votes
8answers
4k 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 $ ... $?
141
votes
7answers
6k 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
1k 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 ...
