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

learn more… | top users | synonyms

8
votes
1answer
57 views

weird ifnum with compact syntax [duplicate]

In some packages like tabularx, I find the following syntax in many places {\ifnum0=`}\fi or even \ifnum0=`{\fi} But I can't figure out why this can be useful for? Is ` a register of some kind? ...
1
vote
0answers
14 views

Creating a new variable from two variables, chosing primarily one and only the other if the first is missing [closed]

i am creating a new variable from two old ones in spss, the old ones have a few missing ones. I want the new variable to have the same value as var1, but if var1 has a missing value than the new ...
5
votes
2answers
121 views

A symbol for same order of magnitude in math mode [duplicate]

I want to write in math mode that something is compared to something else. It is, I want to say that both quantities have the same order of magnitude. What symbol should I use? ...
12
votes
2answers
454 views

What is the difference between square brackets and curly brackets in a command invocation?

Pardon the naive beginner question. In a command like: \textcolor[HTML]{4C7045}{dark green text}, or \documentclass[12pt]{article}, or \begin{figure}[htb], why are some arguments surrounded by [] and ...
5
votes
3answers
192 views

Why is TeX/LaTeX-“programming” so different from other languages in terms of syntax?

Usually, e.g., when I want to have an if, I do something like this: if(value) { ... whatever code ... } But in LaTeX, its: \ifnum\count0<100 ... whatever LaTeX-code ... \fi There are ...
1
vote
1answer
42 views

numbers in BibTeX entries: syntax highlighting vs. reality

The following example has one relevant entry for this question, the year field. @INPROCEEDINGS{1181437, author={de Oliveira, W.R. and De Souto, M. C P and Ludermir, T.B.}, booktitle={Neural ...
1
vote
0answers
44 views

ASCII characters used in plaintext representation of TeX [closed]

I'm writing a parser/transformer thingie that accepts valid LaTeX, and emits valid LaTeX. Is there a list of ASCII characters that are allowed in TeX math mode? Or is any character fair game? ...
4
votes
1answer
85 views

How can I highlight SPSS Syntax code with the listings package?

I'm writing my master thesis at the moment and I want to add some code listings to the appendix. The code is written in "Syntax", the programming language of SPSS Statistics. Is there a way to ...
15
votes
2answers
435 views

Why does `x_\text y` work?

As far as I have understand the tokenization in LaTeX, x_\text y will be split up into x _ \text y Now the _ will consume/bind to the next token. However, \text takes an argument as well. If _ ...
4
votes
0answers
51 views

Why `\\` is wrong here? [duplicate]

The following codes return errors \documentclass{article} \begin{document} cd\\ [asd] \end{document} But this one will work \documentclass{article} \begin{document} cd [asd] \end{document}
1
vote
1answer
43 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 = ...
1
vote
0answers
79 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
103 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
88 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 ...
3
votes
3answers
218 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} ...
3
votes
2answers
174 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. ...
4
votes
2answers
85 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
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? ...
2
votes
1answer
86 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
150 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 ...
4
votes
1answer
120 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
508 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 ...
0
votes
0answers
42 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 ...
13
votes
1answer
144 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
106 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 ...
9
votes
2answers
142 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 ...
7
votes
1answer
240 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 ...
0
votes
0answers
33 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?
3
votes
1answer
121 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
49 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
57 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
109 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> ::= `<--' ...
3
votes
1answer
290 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 ...
5
votes
2answers
187 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
127 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
255 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
100 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 ...
5
votes
1answer
149 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 ...
2
votes
1answer
46 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 ...
1
vote
2answers
2k 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
139 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 ...
4
votes
1answer
309 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 ...
8
votes
1answer
115 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)}, ...
3
votes
1answer
48 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 ...
2
votes
1answer
81 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 ...
2
votes
1answer
105 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 ...
4
votes
2answers
412 views

What's the correct syntax for accents?

I've found that writing "Sáenz": S\'{a}enz S\'aenz S{\'a}enz S{\'{a}}enz Produces the same output. It gets even trickier when you have two accents in a row, such as in "comunicação" (portuguese): ...
3
votes
0answers
214 views

Regular expressions in listings [closed]

I'm looking for a possibility to use regular expression in listings. I'd like to highlight each N thats followed by 4 decimal numbers for example N1234. How can I achieve that? Here is an example: ...
2
votes
1answer
715 views

Syntax highlighting for different programming languages [duplicate]

In my paper I want to include some source codes with colored sytax. For syntax highlighting I use the listings package: \lstset{frame=tb, language={[Visual]Basic}, aboveskip=3mm, belowskip=3mm, ...