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

learn more… | top users | synonyms

1
vote
0answers
59 views

Tab based syntax wrapper around LaTeX?

In text file formats, if one allows for tab based formatting one can simplify things considerably. Are there any simple syntax wrappers that compile directly to LaTeX? I'm thinking of something that ...
1
vote
1answer
29 views

Can I query the current value of randomseed in Metapost?

Metapost allows you to set a seed for the random number generator, so that you can get a predictable sequence of numbers from uniformdeviate and normaldeviate. I can set it like this: randomseed := ...
1
vote
1answer
36 views

Create generic containers that dynamically expand for text

Problem: I am trying to create color containers that can hold text that vary in size. What I have not been able to figure is what method you should use in order to achieve this. Example 1: ...
1
vote
1answer
197 views

Does underscore signify a function call?

What is the _ used to signify when following some sequence like \hat? The error I sometimes get leads me to wonder if it represents a function call, with whatever follows it being the arguments.
4
votes
1answer
39 views

Calculator package and Math Times Pro 2

When I try to use the calculator the mtpro2 package at the same time I get an error message. Recently I found out that this issue has something to do with the \SQRT command. ...
4
votes
2answers
72 views

Why \texttt and \verb giving errors when using with LaTeX commands inside their input

On latest version of MikTeX, following works: \begin{align*} \int sinxdx && \texttt{test line 1}\\ \int{sinx}dx && \texttt{test line 2}\\ \end{align*} But the following gives error: ...
6
votes
2answers
495 views

What is the role of an unescaped circumflex or hat character “ ^ ”?

Is there any use for the unescaped ^ in (La)TeX, when not in math mode? If not, I couldn't see why it's necessary to escape it.
0
votes
0answers
15 views

seqsplit error: \SQSPL@scani has an extra }

I created some commands to allow me to easily handle Japanese text in Latex. Recently I added seqsplit to automatically break lines, as Japanese text is handled as a single word due to the lack of ...
0
votes
0answers
14 views

When I am using {subfigure} option with \documentclass{report} it is working fine but if I use {subfigure} option with \documentclass{llncs}

When I am using subfigure option with \documentclass{report} it is working fine and I am able to use it but if I use subfigure option with \documentclass{llncs} then the figure numbers are increased ...
1
vote
1answer
59 views

Python code block outside of margin

I want to include some Python code to my Latex document. I have read this Tex Stackexchange question and added the following code to get syntax highlights: \usepackage{color} ...
0
votes
1answer
37 views

problem on numbering of equations

I am trying to write equations in latex: See this following code: \documentclass{report} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amscd} \usepackage{accents} ...
-1
votes
1answer
106 views

latex code diagram

It will be helpful if someone writes for me the code in latex for the following diagram and explain the code. The inverse limit is taken over s
1
vote
1answer
52 views

question in latex

\\ command in latex creates a new paragraph. I want a command in which when I finish a line, I want to have next line black and then I want to start from the left of next line. Is there an easy ...
0
votes
0answers
40 views

Why use \[ … \] and not $$ … $$ for displayed math mode? [duplicate]

For displayed math mode, one can use either one of : \[ ... \], or $$ ... $$, or even \begin{displaymath} ... \end{displaymath} But I see many people here saying: never use $$ ... $$ for ...
4
votes
1answer
205 views

What is the actual function of “&” in math environment?

First of all, I must and want to say that I really like the idea of this website. It's pretty awesome to have a place like this where you can ask all your questions regarding LaTeX/TeX. :D My ...
1
vote
0answers
42 views

Typesetting a context-free grammar [duplicate]

Is there a latex package that can be used to produce a language grammar similar to the following figure? If yes, which package?
2
votes
1answer
137 views

Syntax of Using Math Mode: Empty Lines (Beginner Question)

I'm just starting to learn LaTeX. I tried typing \begin{equation*} (sample of different operators and symbols separated with \,) \end{equation*} and I got a whole bunch of errors. It seems LaTeX ...
2
votes
1answer
48 views

How to right-align text in a grammar environment?

Using the grammar environment of the syntax package, I cannot find a way to right-align text in my syntax definition: \documentclass{article} \usepackage{syntax} \begin{document} \begin{grammar} ...
14
votes
2answers
518 views

History of the command \verb

Recently I inherited some LaTeX code for a CV that contained an e-mail address typed with \verb}john.smith@uni.org}. This snippet was in the middle of an multicol environment (so it was within several ...
2
votes
1answer
114 views

TikZ/PGF number in shape name

I'm currently creating my own shapes in TikZ. I'm trying to get a multiplexer to work, but I named the shape mux4to1 and one of its anchors D0. Basically, I'm getting a syntax error with the ...
4
votes
1answer
99 views

LESS and SASS source code formatting

I need to add piece of source code in LESS and SASS. Piece of code is divided into two columns. First column is source code in Less and second column in Sass, something like on this page, but without ...
4
votes
1answer
165 views

Macro take argument without wrapping in brackets?

I want to make macro which do not require curly brackets to accepts an argument. Lets invent an example. Say I want a macro which accepts an optional argument f and an argumentx: \dd[f]{x} And ...
5
votes
3answers
153 views

Delimiting-a-macro-with-itself-chain

Reading this question and the answer of @Werner made me think about if it is possible to have chains of self-delimiting macros like \XX abc \XX def \XX xyz or lets say \begin{someenv} \XX abc \XX ...
3
votes
2answers
68 views

Quotes within quotes breaking

When a word in single quotes falls at the end of the quotation, LaTeX decides to render it as "' instead of '". For example: ``He said it was `off the hook''' would render: "He said it was 'off the ...
2
votes
1answer
334 views

Problem with umlaut in Texworks

I can't seem to input the syntax for an umlaut. Here is what I write \documentclass[12pt]{article} \setlength\parindent{0pt} \usepackage{amsmath} \numberwithin{equation}{section} ...
4
votes
1answer
249 views

How should I write $x^*^2$

I want to raise the variable $x^* $ to the second power. Is there a standard way to write this? Perhaps by instead of using $x^* $ using some special star operator I am unaware of.
0
votes
0answers
98 views

Undefined Control Sequence in \multido or \pspicture?

I wrote the following very simple program as I'm trying to make an animation using pstricks and multido, but I get "undefined control sequence" on the end pspicture line. Can anyone just tell me ...
4
votes
1answer
245 views

Problem with listings package for Python syntax coloring

I am implementing the method I learned here for putting Python code in Latex. Everything works great except that I have problems with comments. Here's the code from the link I mentioned: ...
9
votes
2answers
499 views

A better way to do nested lists

This is how you type set a nested list in LaTeX: \begin{itemize} \item I have a house \begin{itemize} \item It has 4 walls \item a roof, \item two windows, ...
5
votes
5answers
266 views

add (a little bit long) comment on the equal sign?

There are posts here explained how to Add a comment on top of "equal" and "approximate" symbols , the idea is to use \stackrel{text}{=}, however, if the text is a bit long, for ...
6
votes
1answer
102 views

Redefine \middle| to insert space before and after itself

I want to use \middle| inside of brackets like this. \documentclass{article} \begin{document} \begin{equation} \left\{\frac{1}{n} \middle| n>0\right\} \end{equation} \end{document} ...
8
votes
1answer
80 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
22 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
1k 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? ...
15
votes
2answers
828 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
283 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
100 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
90 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? ...
5
votes
1answer
306 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
484 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
61 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 = ...
2
votes
0answers
177 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
411 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
163 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
549 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
495 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. ...
2
votes
1answer
172 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
295 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
190 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 ...