Questions tagged [syntax]
{syntax} is about the principles and construction of the (La)TeX language.
341
questions
0
votes
2
answers
64
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 ...
1
vote
1
answer
47
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 ...
0
votes
0
answers
23
views
How to create rectangular table with a headline part?
What are the package and syntax for making a table for writing an algorithm? For example, a table in the picture below with the same title on top.
2
votes
1
answer
58
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 ...
1
vote
0
answers
42
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{...
0
votes
0
answers
40
views
using custom font for math functions
So I understand that mathastext can be used for this purpose, but I've no idea how to do it for custom font. the syntax would be really helpful. also, I am using overleaf.
\documentclass{article}
\...
0
votes
0
answers
39
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....
2
votes
1
answer
80
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}) \...
3
votes
3
answers
92
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}. ...
4
votes
1
answer
694
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 ...
1
vote
0
answers
42
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 ...
0
votes
1
answer
37
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 \( ...
1
vote
1
answer
65
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 ...
0
votes
0
answers
39
views
How do I specify that tikz not use arrows
I'm writing a latex doc where I have several diagrams. One of my diagrams requires arrows, but then I also have a syntax tree, and for that I don't want the edges to be arrows. Can I specify that ...
0
votes
0
answers
31
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://...
0
votes
2
answers
162
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 ...
1
vote
0
answers
58
views
Could anyone explain to me syntax for longtable? [closed]
What does \begin{longtable}{@{}l*{9}{c}@{}} exactly mean?
3
votes
1
answer
60
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);
# ...
4
votes
4
answers
526
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 \...
1
vote
1
answer
2k
views
MikTeX sources and LaTeX language
Am I right that MikTeX sources in C++ contain the code that opens .tex file (when I run latex.exe myfile.tex), reads it, parses commands, performs them if they are correct and logs error messages ...
0
votes
1
answer
30
views
Typing Brackets '[' ']' Within a Node in Tikz Q-Tree
I am trying to make a tree with Tikz Q-Tree wherein one of the nodes/the text shown needs to read: [+past]. However, brackets are used in the construction of the tree itself, so when I include them in ...
1
vote
1
answer
17
views
foreach syntax missing endcs.., tex cap exceeded
I want to draw points in a loop. x and y coordinates are given ( two variables). I think it is syntactically right, but tikz dont. Can anyone help?
mwe:
\documentclass[]{article}
\usepackage{tikz}
\...
0
votes
2
answers
44
views
Issue with curly brackets in beamer - why?
I am struggling with a macro which auto-generates some frames in beamer. While doing so I came across a situation I do not fully understand. My pedagogical examples boils down to the following:
\...
6
votes
3
answers
150
views
Using \boxed{} in \newenvironment{envname}{here}{and here}
There's a type of environment (shown below) which I'm using very frequently. I would like to define a new environment to begin it and end it with single commands.
\begin{equation}\boxed{\boxed{
\begin{...
3
votes
1
answer
111
views
double subscript error from auto-generated latex
This auto-generated latex from sagemath software generates error Double subscript
I wanted to report this to sagemath, but wanted to check first why this is showing up
Inside sagemath on Linux, I type
...
3
votes
2
answers
118
views
Tikz-cd Crossing Over Issue
I'm drawing a diagram and I want one specific line to be crossed over by all others that pass by it. I'll put the picture of my diagram below for you to see what I want.
So, the red arrow indicates ...
1
vote
2
answers
71
views
Overbrace on Powers
How can I make an overbrace on powers without it being buggy. Example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{...
0
votes
2
answers
78
views
How can you specify an order for quote marks in LaTeX?
I have a segment where the original text uses two different quote marks next to each other like "''" to show speech within a quote. I need to recreate this in LaTeX.
\subsection{35}
This ...
0
votes
0
answers
32
views
Is it safe to omit braces around the command name being defined with \newcommand or \renewcommand? [duplicate]
I see both type of coding style in use:
\newcommand{\hello}{Hello, World}
\newcommand\hello{Hello, World}
My question: Is there any situation where removing the braces around the command name being ...
1
vote
1
answer
116
views
What do you call, and how do you use, this "red!5!white" color syntax?
I've only ever seen this red!5!white sort of color notation with exclamation points and color names mixed with numbers in LaTeX. I want to learn how it works, but I don't know what it's called, so I ...
1
vote
0
answers
49
views
Why were .tex files lost while .synctex.gz files created. How to recover .tex files?
Today I found that most of my .tex files created or modified between July 2019 and last week are gone, so are .pdf files produced by these .tex files. Instead, corresponding .synctex.gz files are ...
1
vote
1
answer
66
views
Why is autoref displaying a blank space in place of the "figure" text when referencing
I am currently writing my masters thesis and ran into a little problem.
I have created a figure consisting of three smaller figures, each with their own subtexts, rendering the figures as 4.1a, 4.1b ...
3
votes
3
answers
148
views
How do I write a long vertical line in a group definition?
Given the following definition:
$ \partial K_R (z_0) = \{ z \in \mathcal{C} \vert |z-z_0| = R \} $
Both \vert and \mid give the same short line as | (from keyboard).
I'd like a seperator line that is ...
0
votes
0
answers
39
views
Listings doesn't highlight everything
I'm having an issue with a custom \listings enviroment:
\begin{document}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
numberstyle=\tiny\...
0
votes
2
answers
70
views
Command to draw arc issue
I have the following code defined outside \begin{document}:
\newcommand{\point}[2] {
({#1}, {#2})
}
\newcommand{\arcpoints}[6] {
({#1}:{atan((#5 - #3)/(#4 - #2))}:{#6})
}
I am getting an ...
2
votes
1
answer
69
views
Is there a formal definition of the BibTeX syntax?
I was recently tasked with extracting information and consolidating a large number of BibTeX files. Should be easy enough, there are perl and python modules to parse it... Well, that's what I thought. ...
0
votes
0
answers
141
views
Syntax error (1067230): Unknown filter 'Crypt'
I'm running into a strange problem: when running my LaTex code on 1 pc, I do not have any problem (running with TeXstudio).
When running exactly the same code on another pc, I get the error "...
0
votes
1
answer
122
views
Syntax error in LuaLaTeX \directlua code
I have the below document that I try to compile with LuaLaTex (using the MiKTeX package).
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\expandafter\...
0
votes
1
answer
54
views
Adding a date to my title page given my current usepackage set
Very new user of LaTeX here making my first ever document using this typeset. I'm just about done, but am running into a really annoying issue with incorporating a course name and date on my title ...
1
vote
0
answers
43
views
How do I write more than 1 condition under a \bigwedge? [duplicate]
What I want:
Now I can easily write the first condition $w \in V(G)$ myself, but how can I add a second (and a 3rd and a 4th) condition under it?
1
vote
1
answer
210
views
Syntax error with INCOLLECTION, booktitle in bibtex
My .bib file looks like this:
@incollection{stal2,
author = {Robert Stalnaker},
title = {Assertion}
booktitle = {Context and Content},
publisher = {Oxford University Press},...
0
votes
0
answers
18
views
Correct syntax for \text in math mode [duplicate]
In some contexts, I see the \text command used as follows:
$ A_\text B $ , which renders correctly as italics A subscripted by a roman B. However, I recall that I "read somewhere" that the ...
1
vote
2
answers
272
views
Textbf not working for subscript
\textbf{C$_{global\_binary}$}
The above is the code I use, the generate text is
I want to make "global_binary" subscript also in bold, how could I do this?
2
votes
1
answer
87
views
Moving the quote in the ModernCV banking style
I'm having problems moving some parts of the header in the banking style
I managed to move most of it with
\patchcmd{\makehead}% <cmd>
{\setlength{\makeheaddetailswidth}{0.8\textwidth}}% <...
0
votes
0
answers
42
views
How to use command \chapter with customised looks in report
i'm new to latex. I met recently a problem at using \chapter from report class. When I use the \chapter{Introduction}, it will turn out as the following.
but I want to have the form like 1 Introdution ...
45
votes
1
answer
3k
views
(La)TeX -- What does the '%' character do?
the % character seems to have a lot of uses. So far, I have encountered it in the following places:
For writing comments
% Schrodinger wave equation
$$\nabla^2\psi + \frac{8\pi^2m}{h^2}(E-V) = 0$$
(...
1
vote
1
answer
86
views
Why does the "LaTeX" logo have random capitalisation and letter height? [duplicate]
Why does LaTex have random capitalisation and letter height?
Context:
So I'm sure this is a rather random question which probably has a really obvious answer, but since I couldn't find it on this site ...
9
votes
1
answer
826
views
What is the difference between \\* and \\ *?
I used a * in a bsmallmatrix and found a curious effect. If I write \\* the * is not printed whereas with \\ * it is. Do you guys know why this happens?
My tiny example and screenshot follow below:
\...
2
votes
3
answers
150
views
syntax error with $
\centering
\begin{tabular}{ |p{4cm}|p{8cm}|}
\hline
Model& Branching Fractions \\
\hline
\widetilde{B}-\widetilde{t}\ \text{coannihilation}& 79\% $\tau{^{-}}\tau{^{+}}$,\ 15\% $b\overline{...
0
votes
1
answer
68
views
How do I number my images as examples?
I am trying to insert Syntax trees into a paper I am writing, but I am not sure how to number them. My trees are .png files, and I am inserting them into the document using \begin{figure} however, ...