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

learn more… | top users | synonyms

2
votes
1answer
134 views

Label on grammar environment

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 ...
88
votes
4answers
3k views

Techniques and packages to keep up with good practices

Question What techniques and packages are there to keep up with good practices? What I already know I already know of the following packages for this kind of purpose: ...
1
vote
1answer
7 views

lhs2TeX and Syntax conflicting on <> characters

I'd like to use Syntax and lhs2TeX together, but Syntax's usage of <> in production rule names seems to conflict with lhs2TeX: \documentclass{article} \usepackage[nounderscore]{syntax} ...
19
votes
7answers
4k 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.
190
votes
9answers
17k 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
83 views

Customising Syntax Highlighting in TeXmaker

I'm wondering if there is any way to add new syntax highlighting patterns to TeXmaker. I've been using TeXworks for years and I love that special characters $ & { [ etc. are highlighted ...
34
votes
2answers
24k 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, ...
18
votes
1answer
282 views

Is there a reason for \usepackage with options in a separate line?

I understand that these two commands do the same thing: \usepackage[letterpaper, landscape, margin=2in]{geometry} and \usepackage{geometry} \geometry{legalpaper, landscape, margin=2in} Is there ...
3
votes
3answers
1k 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} ...
0
votes
0answers
20 views

How to add a rule/command to not color text in <> in tcblisting?

I have the following listing with some code inside: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{beramono} \usepackage{xcolor-solarized} \usepackage[many,listings]{tcolorbox} ...
35
votes
2answers
41k views

How do I put text over symbols?

This is difficult for me to explain, but how do I put words over a symbol? For instance, I want to add words over an equal sign. Anyone know the command/syntax for that? Also adding ^ doesn't cut ...
0
votes
2answers
80 views

How to convert $…$ to \(…\) [duplicate]

So according to Why is \[ ... \] preferable to $$ ... $$? and Are \( and \) preferable to dollar signs for math mode? I should be using \(...\) instead of $...$ and \[...\] instead of $$...$$. But ...
3
votes
1answer
24 views

Persistent syntax coloring in TeXworks

I am using TeXworks. I know the syntax coloring can be enable by choosing Format/Syntax Coloring/LaTeX. However I have to do this every time I open a tex file which is a bit annoying. Is there a ...
1
vote
1answer
143 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
1answer
40 views

Backticks versus real quote marks

So, I'm a Mac user, and a little bit of a type nut (probably not compared to many users on here, though! :P) I've been happily typing emdashes and curly-quotes on my keyboard for years, and years: ...
2
votes
1answer
46 views

How to write notations of equations in LaTeX. (Text and Mathematical operator together) [duplicate]

I want write the following sentences in LaTeX. n_e and n_i are the density of electrons and ions; m_\alpha and Z_\alpha are the mass and charge number of species \alpha; v_e and v_i are the ...
1
vote
0answers
78 views

Latex highlighting error for lstinline

it has been quite a while that I have this problem and I have searched everywhere online and couldn't find a solution. The problem is latex syntax highlighting doesn't work after this line: ...
7
votes
2answers
138 views

How do I include the EBNF square brackets on a new line and set the font to typewriter throughout my grammar in the syntax package?

I want to add an EBNF grammar to my document and following the answers here and here, it seems that the most popular package for this is syntax. However, in the documentation it is not clear how to ...
8
votes
2answers
289 views

How can I convince texcount that my use of \newcolumntype is perfectly valid syntax?

Note that not counting words is not an option. All journals in my discipline require a word count on submission, as do most anthology editors, conference organisers and other institutional powers. ...
1
vote
1answer
90 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
1answer
352 views

Typesetting the “long division” in LaTeX

How can I write the following in LaTeX? The traditional division in LaTeX which I've not considered before.
1
vote
0answers
38 views

MathJax won't render full equation, but will render all its parts [closed]

I have the following tex: \\[ s_N = \sqrt{\frac{1}{N} \sum_{i=1}^{N} (x_i - \overline{x})^2} \\] \\[ \overline{x}_N=\frac{1}{N}\sum_{i=1}^{N} a_i \\] Trying to narrow down if anything is ...
4
votes
4answers
112 views

Syntax for in-complete differential [duplicate]

I am looking for the syntax of the $d$ with the apostrophe, as in the picture. I tried at wiki's help page but wouldn't find. Any suggestions?
0
votes
2answers
34 views

Latex command for a specic picture of aligned equations

I want to type the following in latex In principal I want to have a long equation in the beginning line. Then I want to have short equations properly centered (with each other and also with the long ...
0
votes
1answer
50 views

How to define a new command?

I want to define a command that will automatically do the following: \textbf{\citeasnoun{CITATION}} So then I can just do: \boldcite{CITATION} I tried the following but it doesn't work \def ...
15
votes
1answer
231 views

How do I insert a tie (~, non-breaking space, tilde) 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
90 views

Highlighting of $…$ syntax in WinEdt 9

In WinEdt 8.0 the text within dollar signs $...$ in the .tex file was highlighted by using a different background color than the rest of the text. I installed WinEdt 9.0 and this effect is no longer ...
2
votes
1answer
228 views

Paragraph ended before \math@egroup was complete (and other fun) [closed]

I was working on my thesis which is due in a week when all of a sudden I started getting errors on my title page, specifically Paragraph ended before \math@egroup was complete Missing $ inserted ...
3
votes
0answers
211 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 ...
0
votes
0answers
63 views

What is the dollar sign ($) used for when writing LaTeX code? [duplicate]

In LaTeX examples I sometimes see formulas included in dollar signs ($d+o$). Why?
21
votes
6answers
1k views

LaTeX Markup Options?

I was wondering what prevented the implementation of a MarkDown system in (La)TeX? I know that pandoc does a conversion of MarkDown with extra features to LaTeX. I also know that many are happy with ...
18
votes
5answers
6k views

The key to understanding the LaTeX syntax

I'm having serious problems understanding the syntax of LaTeX well. I know a lot of programming languages but LaTeX still is a little cryptic for me. Do you know what the key to fully understanding it ...
8
votes
3answers
439 views

A (La)TeX with only one special control character in the source file

One thing I find annoying about (La)TeX is that there are too many special characters. To have any of \ $ % & # _ ~ ^ { } in a text in the document we have to escape it using \. Personally I ...
0
votes
0answers
42 views

Kile - syntax highlighting of new command

I made the following changes to my /usr/share/kde4/apps/katepart/syntax/latex.xml file for Kile: in the <highlighting><contexts> section, I added the line <StringDetect ...
3
votes
1answer
55 views

newenvironment with braces split between start and end

I'm defining a command for placing figures in the margin. A simple version follows: \documentclass{article} \newcommand{\margin}[1]{\marginpar{#1}} \begin{document} \margin{Figure goes here} ...
5
votes
3answers
1k views

Warnings and errors highlighting when compiling in Bash environment

I'm processing a large document, using Latexmk in a Bash environment. It would be very helpful if error and warning messages were somehow highlighted or coloured, in order to facilitate spotting them. ...
1
vote
2answers
124 views

Can I copy text with syntax highlighting

Is there a way to copy LaTeX text out of TeXstudio with syntax highlighting? Will include some macros and small portions of LaTeX in a presentation (Powerpoint) and want to get it as readable as ...
1
vote
0answers
58 views

Accessing Characters with pdfTeX

My goal. I want to use pdfTeX to access characters that appear in the fonts I am using, beyond the ones I can type with 7-bit ASCII text characters. For example: copyright symbol ellipsis accented ...
3
votes
1answer
113 views

Starting environment with \begin{env} or with \env{}

I have noticed that I can start some LaTex environment in two ways. For the frame environment in Beamer, for example, \begin{frame} % .. frame content .. \end{frame} is equivalent to \frame { % ...
5
votes
1answer
2k views

Spaces in files names in \input or \includegraphics

I'm going crazy... I have a file I want to include which path is C:\Users\Matthieu\Documents\Folder withOneSpace\myFile.tex. (As you can see with the \, I'm on windows actually) I tried the ...
5
votes
1answer
193 views

Why do braces around a single-letter argument of a macro affect its output?

I thought \ul 8, \ul8, and \ul{8} are identical ways of passing an argument 8 to a command \ul. However, they produce different output. Why? MWE: \documentclass{article} \usepackage{soul} ...
25
votes
3answers
35k views

Logical “and” character in TeX

I'm trying to write a logical syllogism in the form of ((a -> b) & (c -> a)) -> (c -> b). But I don't know how to write Logical And character. It's something like caret character (^), but not as a ...
1
vote
0answers
109 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
61 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
48 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 := ...
12
votes
2answers
4k views

Why \land instead of \and?

I recently asked the logical and character in TeX and got \land as the answer. My question is, why \land, and why not simple \and? I mean, does l here refer to something technical, or historical, or ...
1
vote
1answer
208 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.
316
votes
8answers
32k 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 ...
86
votes
4answers
110k views

When should one use \verb and when \texttt

Sometimes people here use \verb!A SHORT COMMAND! and sometimes \textt{A SHORT COMMAND}. I'm unsure when to use which. Are there any guidelines or arguments for \verbatim vs. \texttt?
4
votes
1answer
62 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. ...