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

learn more… | top users | synonyms

3
votes
1answer
261 views

Help with custom syntax highlighting for TeXworks

I recently learned of the option to make a custom syntax highlighting system for texworks as laid out in the texworks manual If you go to the *\customizing texworks\syntax highlighting*section of the ...
25
votes
7answers
2k views

What's a good editor for (La)TeX programming?

I've found several questions about editors for writing LaTeX documents ( LaTeX Editors/IDEs seems to be the definitive one). But I'd like to know which editors are out there that help you develop ...
1
vote
1answer
32 views

Remove spaces from source code

I have this code (javascript from language option supported in listings) \lstset{language=javascript} \begin{lstlisting} $('#term').terminal(function(command, terminal) { var cmd = ...
39
votes
5answers
39k 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 ...
1
vote
0answers
51 views

Kile syntax highlighting: A single dollar sign in the preamble

I'm using Kile to edit my LaTeX documents. I define my own custom environment to hightlight LaTeX code named lstLaTeX with the following code: \documentclass[a4paper]{scrartcl} ...
2
votes
1answer
49 views

After changing Kate's LaTeX syntax highlighting file, syntax highlighting for LaTeX can not be selected anymore in Kile

I wanted to adapt the Kate LaTeX Syntax Highlighting file (in my case: /usr/share/kde4/apps/katepart/syntax/latex.xml), to have a different highlighting in Kile, as in the answer to disable syntax ...
4
votes
1answer
69 views

In forest (tikz) for syntax trees, how do I create an arc above one node separating it off from the rest of the tree?

Here's a picture example of what I want: I'm able to make the type of arc that I want with this command: \draw (-2,-2) [black,thick,dashed,domain=45:180] plot ({cos(\x)}, {sin(\x)}) ; But it ...
2
votes
1answer
136 views

A very basic TikZ code that is not working

I tried to type a TikZ code for the first time but it did not compile, and I have no idea why. Is there any other packages that I have to use or is there anything wrong with the syntax? ...
195
votes
8answers
12k 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 ...
4
votes
2answers
4k 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
136 views

Using htlatex with tikz-dependency

I am trying to generate an html file from a tex file using htlatex. The htlatex works well with simple tikz pictures, but it has problem with the pictures (trees) drawn with tikz-dependency package. ...
3
votes
3answers
185 views

Make an exam format with a logo

I am trying to make a header of an exam page but with logo. Below is my code. \usepackage{graphicx} \begin{document} \firstpageheadrule \begin{figure}[] \includegraphics[width=20mm]{logo.png} ...
14
votes
2answers
6k views

How to highlight Python syntax in LaTeX Listings \lstinputlistings command

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
4
votes
2answers
58 views

Problems Using AVM package for LFG structures

I am trying to draw LFG f-structure matrices using the avm package (https://www.essex.ac.uk/linguistics/external/clmt/latex4ling/avms/). For some reason my avm objects do not respect the \\ command, ...
2
votes
1answer
63 views

What comand should I use to fork used in math [duplicate]

When doing practical math, you often fork your calculation due to some conditions, eg. when doing equations with absolute value. There is a symbol for this, and I wonder if mathJax can render this one ...
3
votes
0answers
143 views

How do you read LaTeX syntax

Coming from the programming language side, I am used to the very regular syntax of these languages. E.g. in Python a function call has to be like below: callfun(arg1,arg2,key1=val1,key2,val=2) This ...
22
votes
2answers
565 views

The rhyme and reason of function argument syntax (brackets versus braces)

I'd like to gain some intuition as to the choices of brackets versus braces in function arguments. As in [...yadda...] versus {...yadda...}. I'm a long-time user of LaTeX but am poorly educated as to ...
4
votes
1answer
80 views

Add keys to table (with picture and code) [duplicate]

As you see in the red part of the picture, I would like to add keys to explain what the brackets stand for. I just added this with paint, but is there a way to do this in tex? Also, are there nicer ...
23
votes
2answers
503 views

Backward definition of (La)TeX commands

Again and again I see, that TeXnicians define commands and do several things with them in the reverse order, I would do this as amateur. See this example: In his answer to scrpage2: Three ...
22
votes
1answer
5k views

\varepsilon vs. \epsilon

I cannot remember anyone writing the letter epsilon in any other way than \varepsilon in any math class; but in LaTeX \epsilon and \varepsilon are different symbols. Do anyone of you know why there ...
0
votes
0answers
34 views

CAS Syntax in LaTeX

Good evening, I am creating a LaTeX file that is a Lab for Maple. I would really like to have the CAS syntax in My LaTeX file. Meaning is there a way I can have LaTeX x^2 without wanting to make ...
2
votes
1answer
75 views

Label on grammar enviroment

I want to have a caption and label on my grammar environment, and have implemented the solution here: How to use caption and label in grammar environment? got my grammar displayed with a caption and a ...
13
votes
1answer
141 views

How do I insert a tie (~) under expl3 syntax?

I need to define a token list of the form \tl_new:N \g_silly_tl \tl_set:Nn \g_silly_tl { Text ~ and ~ a ~ tie:?? } How do I do this? More generally, is there a reference where one can see how ...
3
votes
1answer
80 views

Why is my cross reference not working and some other questions

I am a TEX beginner and I am now learning how to create a reference. I am reading the book "The Not So Short Introduction to LATEX2" by Oetiker, Partl, Hyna, Schlegl; on page 42 section 2.8 Cross ...
7
votes
1answer
220 views

Clear and readable syntax style for tikz trees with edge labels and options

I'm fairly new to tikz and TeX but I don't have a problem writing the code for the tree. I just would like to have a human readable tree. Here's a minimal expample of the tree without edge labels or ...
9
votes
2answers
138 views

Can spaces at the beginning of a line ever cause problems?

To structure my sourcecode, I often use spaces for padding: \newcommand{\st}[1]{% \begin{tabular}{lr} \emph{Student} & \emph{Score}\\ #1 \end{tabular}% } Can this ever cause ...
0
votes
0answers
32 views

How do you format a Dates Contraction in LaTex? [duplicate]

I'm writing a paper and I need to include a date, for example 20th January 2011. How can I make the Contraction smaller and position it correctly as an ascender/superscript?
15
votes
7answers
2k 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.
3
votes
1answer
104 views

Applying Matrix Operation Code

I'm (relatively) new to LaTeX, and I'm having a syntactic problem using the wonderful code here, which allows arbitrary matrix operations in LaTeX. I wrote a macro to generate certain matrices. ...
2
votes
1answer
45 views

Short syntax for including multiple times the same pages in pdfpages

Using the pdfpages package I can do something like this to merge some pages of a document. \includepdf[page={1,1,1,2,2,10,10,10,10},nup=1x2]{mypdf.pdf} In this case 3 times pages 1 and 2 times ...
1
vote
0answers
56 views

Dialect of the `[1.]` suffix in `\begin{enumerate}[1.]`?

I have a tool (pandoc) that is producing tex. Among the output is the following: \begin{enumerate}[1.] \item foo \item bar \item baz \end{enumerate} pdflatex then refuses to compile it with error ...
5
votes
0answers
119 views

“Standardizing” LaTeX code? [duplicate]

Is there a program for LaTeX code akin to HTML Tidy that "standardizes" or "canonically" formats (automatically indents, spaces, etc.) LaTeX code? AucTex formats code, but it doesn't appear to create ...
3
votes
1answer
96 views

How to change font-size for a grammar declaration

I have a grammar declaration like this: \documentclass[12pt,a4paper]{report} \usepackage{syntax} \begin{document} ... \begin{figure}[h!] \begin{grammar} <A> ::= `<--' ...
5
votes
1answer
145 views

Relational Grammar arcs

I'm quite used to draw syntactic trees and even AVMs for different linguistic theories, but I've stumbled upon the need to draw Relational Grammar / Arc-paired grammar arcs for a paper I'm writing ...
5
votes
2answers
182 views

Why various syntaxes for various commands?

I understand that the standard syntax of commands in TeX is \name[optional-1]…[optional-n]{argument-1}…{argument-n} The tabular environment, however, apparently takes its optional arguments after ...
1
vote
1answer
106 views

Syntax highlighting for SPARQL query in a listing? (works fine in minted environment but not in listing with mint)

I can do syntax highlighting in the minted environment, for any SPARQL query using this Pygments lexer thanks to this answer. My problem is how to get SPARQL syntax highlighting to work with mint in ...
6
votes
1answer
215 views

Change how to enter a matrix in Latex

In Matlab I can create a matrix by typing A = [1 2 3; 4 5 6; 7 8 9], for this the space is a delimiter between the entries of the matrix. I am wondering if there is a package which makes it possible ...
6
votes
1answer
94 views

Commands with Capital letters in their name

A topic that appear over and over is to explain the difference about commands such as \operatorname vs. \DeclareMathOperator. So far I've seen discussions about using one or the other, but no one ...
2
votes
1answer
44 views

Changing Format of Table Entries

I had attempted to shorten this table and I think I don't think I've edited it properly. In particular I think that I've made a mistake changing everything up to the numeric entries. Would anyone ...
4
votes
1answer
301 views

What tool to make flow graphs in Linux?

SQLite documentation is very nice with graphs such as Any idea of what software can I use to do similar picture? It would be perfect if the images could be described textually, instead of drawing ...
1
vote
2answers
1k views

Syntax highlighting in listings for C# that it looks like in Visual Studio

Community, I want to get my C# listings syntax highlighted like in Visual Studio but I did not get it so far. Here's an image of the syntax highlighting of Visual Studio: Here is the code I have: ...
3
votes
0answers
133 views

minted creating garbage output on PDF file [closed]

Good Day, I'm using texlive 2013 which I updated today 20JULY13. When I attempt to compile my LaTeX file using only the most basic minted statements \begin{minted}{c} Test \end{minted} results in ...
8
votes
1answer
100 views

TikZ: using the draw let in syntax to create an arc but the arc and its difference angle doesnt add up to 360

Consider this code snippet: \draw[-latex] let \p0 = (P6), \p1 = (P5), \p2 = (P4), \n1 = {atan2(\x1 - \x0, \y1 - \y0)}, \n2 = {atan2(\x2 - \x0, \y2 - \y0)}, ...
118
votes
4answers
5k 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?
3
votes
1answer
46 views

my equation breaks into two rows

I have the following problem: These equations don't compose into a single line, instead, they break into two lines each of them. There must be a problem with my syntax but I can't seem to find it, I ...
7
votes
1answer
359 views

How to use caption and label in grammar environment?

I can't manage to add a caption and a label to my grammar environment: \documentclass{article} \usepackage{syntax} \grammarindent 80pt \begin{document} \begin{grammar} <condition> ::= "$" ...
141
votes
8answers
6k 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 $ ... $?
2
votes
1answer
98 views

Parts of the text code are grey and missing in the pdf

Hi I am an absolute beginner and so far I was able to solve all problems with the help of this platform and some other forums. But for this one I could not find a fitting thread. I pasted some text ...
3
votes
1answer
482 views

Custom Command Highlighting in TeXstudio

I have defined several macros in my LaTeX report. For instance, following is a macro I defined for writing bold letter H. I have several macros like this I use throughout my work. ...
2
votes
1answer
907 views

Disable syntax highlighting in Texmaker

Sorry for an obvious one, but I'm using Texmaker as my editor and the syntax highlighting has broken down after adding a tikzpicture and is making it very hard to actually see the content. (Everything ...