Skip to main content

Questions tagged [syntax]

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

Filter by
Sorted by
Tagged with
-1 votes
1 answer
49 views

How to refer to specific paragraph with the custom reference name?

Consider the following structure: \documentclass{article} \usepackage{hyperref} \begin{document} \section{Section} ...
PhysiXxx's user avatar
  • 179
2 votes
2 answers
127 views

How to type a ~ symbol in grammar environment of syntax package?

The MWE is like the following. It does not work. \documentclass{article} \usepackage[nounderscore, rounded]{syntax} \begin{document} \begin{grammar} <range> ::= <digit> `~' <digit> ...
Jack Ma's user avatar
  • 37
1 vote
1 answer
29 views

How to repeat a terminal in grammar environment of syntax* package?

I want to type EBNF text in latex. The solution I found is to use the grammar environment of syntax* package. But no word describes how to repeat a terminal in the doc. The EBNF text I want to type is ...
Jack Ma's user avatar
  • 37
0 votes
0 answers
59 views

How package I use for \dimexpr?

I need to use the command \dimexpr, but in my machine no have an package for it. My specific objective is write this string: \newcommand{\cancelraizq}\[1]{ \sbox0{$ \displaystyle \sqrt{\vphantom{#...
Luiz Collovini's user avatar
0 votes
0 answers
35 views

symbol % how and when can I use ir? [duplicate]

I would have some explanation about the % symbols: what do it is intended for? where do I have to use it? Is there a doc that explain it? Thank you Renato
RenatoP's user avatar
  • 851
0 votes
3 answers
43 views

Latex error: Package array Error: Illegal pream-token (3.5cm): c' used

I have a table that has this command. \begin{table}[ht] \centering \centering\caption{Table features} \begin{tabular}{ r{3.5cm} p{5.50cm} p{5.50cm} } \toprule & \multicolumn{1}{r}{} &...
ddocc's user avatar
  • 39
0 votes
1 answer
28 views

Error in reproducing tex on sentence bracketing in gb4e [duplicate]

There is an error occurred when I tried to reproduce a tex document to produce sentence bracketing in gb4e. This is the tex document, courtesy of Alan Munn: \documentclass{article} \usepackage{gb4e} \...
pindakazen's user avatar
4 votes
2 answers
111 views

Redefine the command \cite to be able to use an additional syntax

Background The package amsrefs redefines the command \cite so that one can use the syntax "\cite{book-name}*{optional-argument}" to produce (essentially) the same output as the usual "\...
Lorenzo Pompili's user avatar
5 votes
1 answer
146 views

Expl3: When to define a variable as \l_... or as \g_... type variable?

Is the choice whether a variable should be a \g_ or l_ type variable something a programmer can more or less freely decide on? Or are there some strict rules or at least some best-practices that a ...
Jasper Habicht's user avatar
0 votes
1 answer
67 views

Conditional expressions look always false

Experimenting with conditional expressions, namely with this trivial if... \def\testvar{testvalue} \if\testvar{testvalue}{istrue}\else{isfalse}\fi I get always isfalse. I think I did everything as I ...
peterh's user avatar
  • 341
0 votes
1 answer
104 views

How to write the dash of discrete math in latex?

I don't know how to use dash like this. It's not \bar{}.
Đàm Tiến Đạt's user avatar
2 votes
1 answer
91 views

Stacking multiple TikZ tree labels?

I have a question related to the labelling of TikZ circles within a forest tree. Is it possible to stack multiple labels below the circle so that they would appear under one another, like this? ...
ally69710's user avatar
3 votes
2 answers
166 views

Capital R with whitespace padding

I'm a math and latex novice, and I'm trying to write out the following rule with latex: I'm having a hard time with this capital R. In the textbook, it has that nice side padding but when I type ...
chocojunkie's user avatar
1 vote
1 answer
78 views

TikZ math library syntax problem

I am using TikZ math library which is great. However, I can't get my head around this (see MWE). I missed something from the documentation (https://tikz.dev/library-math)? \documentclass[tikz]{...
17tmh's user avatar
  • 91
1 vote
1 answer
100 views

Can any character be used in place of a backslash?

In Chapter 3 of The TeXbook, Knuth writes: TeX allows any character to be used for escapes, but the “backslash” character ‘\’ is usually adopted for this purpose... This has me confused, for I have ...
Atom's user avatar
  • 665
0 votes
0 answers
24 views

Syntax of LaTeX macros [duplicate]

The TeX primitive \over has syntax {… \over …}. Is it possible to define a macro \foo, say, with syntax {…}\foo{…} without enclosing brackets?
Alois Pichler's user avatar
4 votes
1 answer
388 views

What was the reason behind using sqrt (square root) to name the nth root command? [closed]

Clearly talking about: \sqrt[n]{x} here!
Hamza Nouar's user avatar
1 vote
1 answer
123 views

How to draw a curve to indicate syntactic domain in the qtree?

How to draw a curved line in the qtree and add a description like the following picture? \Tree [.n,v,aP [.n,v,a ] [.$\sqrt{P}$ [.$\sqrt{\alpha}$ ] [.$\sqrt{\beta}$ ] ] ] Thanks!
user296028's user avatar
0 votes
0 answers
37 views

Is the preferred use of tilde command with braces?

It looks like the standard way of using the \tilde is as in $\tilde{a}$. However, I saw a latex document in which the usage was $\tilde a$. Will the two ways of defining a tilde produce the same ...
Andre's user avatar
  • 1,023
1 vote
0 answers
51 views

"\setlength" vs "equal" [duplicate]

This is a very general question. Apparently a duplicate of: Other than syntax what is the difference between \dimen0= and \setlength{}{}? What is the difference between \fboxsep=1cm and \setlength{\...
Vincent Krebs's user avatar
3 votes
1 answer
93 views

Problem with the alignment in systeme package

When I type this: \usepackage{systeme} \begin{document} \systeme[xyzt]{x-iy+3t=0,ix-z-(2-i)t=0,(1+i)x+(2-i)y+(3i-5)t=0,-ix+(1+i)y+z-it=0} \end{document} I'm ending up with this: Which, as you see, ...
NairD's user avatar
  • 31
1 vote
2 answers
333 views

Cross reference not working as intended, the entire name of reference and label gets printed?

So something weird is happening when I installed latex + textstudio on my new machine and tried to compile an old paper: When I write something like In Sec. \ref{sec:Background}, for some reason the ...
OneAndOnly's user avatar
3 votes
3 answers
309 views

Is it possible to use multiple sub- or superscript syntax in math mode?

I often have to write expressions like this in math mode: L_t^pL_x^q For some reason, I am not always satisfied with typing this and I would like to define some new command with the same output. I ...
Lorenzo Pompili's user avatar
2 votes
2 answers
692 views

How to solve "Package tikz Error: Giving up on this path. Did you forget a semicolon?."?

The code that gives this error message is \documentclass[dvipsnames]{standalone} \usepackage{pgfplots} \usepackage{tikz-3dplot} \usepackage{tikz} \usetikzlibrary{decorations.markings} \pgfplotsset{...
Fractal Admirer's user avatar
1 vote
1 answer
53 views

Syntax: use second argument leaving the first argument as default in a macro

I use this command to abbreviate my notation \NewDocumentCommand{\Lp}{O{p}O{\mathbb{R}^d}O{[- \infty, \infty]}}% {L^{#1}(#2, #3)} I've set one default for each argument, in most cases I need just ...
Fral's user avatar
  • 79
0 votes
1 answer
342 views

How to insert table.tex into my latex document

I am trying to figure out how to insert the table I generated in Stata in tex format into my latex document. Currently, I get errors when I copy-paste and after I did modifications to the code. Below ...
ddocc's user avatar
  • 39
3 votes
2 answers
204 views

Constructing \newcommand with caret ('^') or underscore ('_')

I was just wondering if anyone out there was familiar with some apparently less-than-conventional syntax for creating a \newcommand... Sorry if this is kind of basic, but I just wanted to make small ...
Wai-Ga D. Ho's user avatar
1 vote
1 answer
69 views

How do syntax and coordinate calculations work with the Tikz library `calc`?

I'd like to annotate an image in LaTeX using Tikz. I'm rather new to Tikz, so I have been following a tutorial which breaks it down quite nicely. In the tutorial they add an image to a node and then ...
PaulMndn's user avatar
4 votes
1 answer
350 views

\def with number in macro works?

I know that numbers cannot be used in macros, e.g., in \def/\newcommand definitions. Can anybody explain to me why this \documentclass{article} \def\i2{\frac{i}{2}} \begin{document} $\i2$ \end{...
Nico Schlömer's user avatar
0 votes
1 answer
74 views

undefined environment vmatrix

I am an absolute beginner in LaTeX... I am trying to learn it so that I can use it to ask question in websites. I have faced the following problem... I have learned some syntax which is used to ...
Florian Geyer's user avatar
1 vote
1 answer
285 views

help with latex syntax parsing errors

Could anyone help to fix the syntax parsing error ? \documentclass{article} \usepackage[utf8]{inputenc} \begin{document} \begin{aligned} \rho &= \begin{pmatrix} ae^{i\...
kevin's user avatar
  • 111
1 vote
1 answer
74 views

How does \special know which output driver it's addressing?

The TeXbook says that \special{…}is a special instruction to the output driver. But how do you know when you write the instruction which output driver will be reading it?
Marnanel Thurman's user avatar
1 vote
1 answer
50 views

I want a code to rep a big matrix in row wise

\begin{align} \begin{bmatrix} \big| & \big| & \cdots & \big| \\ x_1 & x_2 & \cdots & x_{m-1} \\ \big| & \big| & \cdots & \big| \\ ...
Cutie's user avatar
  • 45
2 votes
0 answers
818 views

Abstract Syntax Tree (AST) for LaTeX

I would like to manipulate a LaTeX document in a program, e.g. add/change used packages or their options and adding environments. Instead of doing this purely on the text level, it would be great to ...
J Fabian Meier's user avatar
0 votes
2 answers
98 views

How to collect texts and place all them together?

I am trying to create two commands: A command \collect that stores a string/text. A command \callcollection that call all these stored texts placed before the command (without any configuration, just ...
TheEndofTheWorld's user avatar
1 vote
1 answer
83 views

Is it a good practice to leave space before mathematical text? [duplicate]

I used to write equations in the following way: Text %Empty line \[ code \] %Empty line Text I have noticed that with this syntax there is more space above the maths than beneath them. Is that ...
ado sar's user avatar
  • 203
2 votes
1 answer
109 views

What is correct? `(-1)^a` or `{(-1)}^a`? [duplicate]

Essentially the title says it all. The TeX linter ChkTeX recommends to group parentheses if sub-/superscripting. It makes the grouped content into an atom (my TeX knowledge is minimal), so it is ...
Gargantuar's user avatar
  • 1,251
1 vote
0 answers
45 views

Good code style introduces whitespace in LaTeX [duplicate]

Suppose I have the following in a test1.tex file: \documentclass{article} \begin{document} \section{A section with a very long title which goes beyond seventy-two columns in text editor} \end{...
user32882's user avatar
  • 1,594
0 votes
0 answers
903 views

How to insert an image in this particular template (ICLR 2022)

Link to overleaf template: https://www.overleaf.com/latex/templates/template-for-iclr-2021-conference-submission/mmpfhsxmqdkp I tried this code: \begin{figure} \centering \includegraphics{pipe....
Academic's user avatar
  • 131
2 votes
1 answer
254 views

plus sign not shown in exponent [closed]

I am writing in Latex in the github markdown as shown below. Why is the plus sign not working in this example? <img src="https://render.githubusercontent.com/render/math?math=P(X^{t + 1}) \...
kiriloff's user avatar
  • 121
4 votes
3 answers
159 views

Infix syntax with Unicode characters

Tex (and XeLaTeX) use what I would call prefix syntax for user-defined macros. For example, the macro \newcommand{\identity}[1]{#1} is used with the variables prefixed by the macro: \identity{vars}. ...
Hector's user avatar
  • 1,100
4 votes
1 answer
819 views

How is TeX syntactically organised?

I'm just starting out on TeX, and I wanted to find a directory or table of how TeX is arranged in syntax. I can make educated guesses, but I figured I'd be better self taught if I understood how ...
yolo's user avatar
  • 169
1 vote
0 answers
277 views

How to define a command in latex for capitalizing following text?

In latex there are commands that change the appearance of their argument, e.g. \textit{foo}. Other commands change the appearance of the following text, without requiring an argument, e.g. \itshape ...
Roel's user avatar
  • 592
0 votes
1 answer
178 views

What are brackets do in new command definition?

In an article about defining new commands I saw an example \newcommand{\R}{\mathbb{R}} The set of real numbers are usually represented by a blackboard bold capital r: \( \R \). What do brackets \( ...
Dims's user avatar
  • 153
1 vote
1 answer
204 views

How to Make Index Recognize an Exclamation Point as Part of an Entry

I would like to add an entry in an index which makes use of an exclamation point as an article of grammar. However (of course), Latex treats it as if I want to begin a subentry. Consider the following ...
DDS's user avatar
  • 10.1k
0 votes
0 answers
119 views

TeXmaker syntax highlighting problems

can anyone tell me why TeXmaker is not coloring my code correctly? For some reason everything below my \newcommandline is in text-colour. When i paste my code into overleaf it works normally (https://...
MichaelS's user avatar
0 votes
2 answers
913 views

Missing number, treated as zero (\hspace, I think)

At the outset let me say I am not even a LaTeX beginner - I know almost nothing. I have an .tex file named title.tex which was developed on a Windows platform and is used in an R markdown document ...
bikeactuary's user avatar
1 vote
0 answers
96 views

Could anyone explain to me syntax for longtable? [closed]

What does \begin{longtable}{@{}l*{9}{c}@{}} exactly mean?
Bisu's user avatar
  • 33
3 votes
1 answer
224 views

Metapost: variable name with number at the end

Why can't I use variable names like a1, str2, x12? Does Metapost consider them as arrays so that a1 is like a[1] and so on? Even z-notation as z1, z2 and etc. does not work. The code is beginfig(1); # ...
Vladimir's user avatar
  • 609
5 votes
4 answers
638 views

How to make commands with mandatory braces?

Partly inspired by this question, I got interested in the question of whether we could (hypothetically) switch to a new LaTeX syntax where braces around arguments were mandatory. That is, no more \...
Gaussler's user avatar
  • 13k

1
2 3 4 5
8