Questions tagged [syntax]

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

363 questions
164
votes
4 answers

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 it..., I want the text to appear ON TOP.
Lemon
  • 3,153
27
votes
2 answers

The rhyme and reason of function argument syntax (brackets versus braces)

I'd like to gain some intuition as to the choices of brackets versus braces in function arguments. As in [...yadda...] versus {...yadda...}. I'm a long-time user of LaTeX but am poorly educated as to the fundamentals. Whenever I try to guess/recall…
Ryan
  • 475
21
votes
1 answer

Why is it not necessary to close this brace?

When I compile the following document, I get no error \documentclass{article} \newcommand{\foo}{foo} \begin{document} Why is \foo{ indifferent about its closing brace? \end{document} yet there is no } for \foo. Using \newcommand* makes no…
Hugh
  • 2,374
  • 17
  • 30
17
votes
2 answers

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 stuff like that? Or is it simply there to prevent…
11
votes
6 answers

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 no brackets and so on, for example, which indicate where…
Perik Onti
  • 343
  • 1
  • 6
10
votes
2 answers

What does "frozen" mean (e.g. for catcodes)?

In a comment (emphasis mine) no, it has to change catcodes and this don't work if they are already frozen in response to my comment on her answer Ulrike Fischer mentioned the concept of frozen catcodes. For the life of me I have no idea what…
9
votes
2 answers

How do I split a command into several lines and have LaTeX read it as only one line?

For example, I have a command which has a lot of options: \documentclass[option1,option2,option3,option4,option5,option6,option7]{article} I want to split it to several lines so I could read the code better: \documentclass[option1, …
Kit
  • 16,430
9
votes
3 answers

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 think this is stupid - after all we are writing a text…
Martin
  • 4,565
8
votes
2 answers

How to use limits and nolimits together?

In some case limits and nolimits need to be used together, e.g. an expression \prod\nolimits^{B}\limits_{x \in X}, in which B is in the right-upper corner and x \in X under the \prod, is not displayed it should be, B is displayed above the \prod,…
Popopo
  • 831
7
votes
1 answer

Where is \textunderscore defined ?

I just started TeX recently and I'm reworking a legacy TeX-piece (book , second edition). I create lots of TeX-tables (with SAS) and do \input them. The tables contain many \textunderscore s. All show up in my pdf as upshifted points and not as…
Werner
7
votes
2 answers

After a backslash did its work

A rather puny question: What is "good practice" to end a backslashed command? At the moment, I simply insert a {} if the following char (can you tell me which ones qualify?) does not automatically end the backslashed command, e.g. $\rho+\Delta{}A$.…
7
votes
4 answers

syntax of passing arguments to a command

From general programming languages, I'm used to calling functions in the following way: myfunction(argument1, argument2, ..., argumentn) It seems like latex requires this syntax \mycommand{argument1}{argument2}...{argumentn} to use commands. Can I…
6
votes
1 answer

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.
Hamit
  • 191
5
votes
2 answers

Syntax error; Undefined control sequence \EndIf

I get the following error when I compile: Syntax error; Undefined control sequence \EndIf Code: \usepackage{algorithm2e} \begin{algorithm}[h] \label{FecEncodeAndSendFECUnits} \caption{Function for Receiving and FEC-decoding FEC-encoded Units of…
5
votes
1 answer

Bracket position rule

What is rule in specifying bracket position: \foo[]{} %or \foo{}[] Following syntaxes are clear, is there any other combinations? \foo{}{} \foo{} ...
Real Dreams
  • 8,298
  • 12
  • 56
  • 78
1
2 3