# Tag Info

154

The short answer is what others have said, % starts a comment that goes to the end of the line. The normal effect is that it doesn't insert the space (or a \par) from the newline. The longer answer is that as TeX parses its input, it reads the input file line by line. It strips off tailing whitespace (including any carriage return and newline) and then ...

151

Spacing is wrong. It is a "deadly sin" according to l2tabu, section 1.6 on page 6: http://www.ctan.org/tex-archive/info/l2tabu/english/

147

$$is TeX primitive syntax, which, as others have commented is hard to redefine (in classic TeX there is no command name which triggers entering or leaving display math). LaTeX doesn't officially support$$. The most noticeable failure if you use the syntax is that the fleqn option will no longer affect the display of the mathematics, it will remain ...

126

Note that if your LaTeX installation is older than 2015, you shouldn't use $$...$$ unless you also load the fixltx2e package. By default, $$and$$ were fragile commands and couldn't be used inside section headings or captions.

124

$$...$$ is LaTeX syntax. $...$ is TeX syntax. plainTeX only allows $. In LaTeX you can use both, but $$...$$ will give less obscure error messages when there is a mistake inside it. Both are shortcuts to start inline math environments. 111 Here is one more reason (this is what converted me). If you use the \begin{proof}...\end{proof} environment, you occasionally end a proof with an equation. The automatic QED box then ends up on a line by itself, which is ugly. You can fix this by writing \qedhere at the end of the equation, but this doesn't work properly with $$...$$ – you have to use ... 91 \par is a TeX primitive and is the same as a blank line (except in special environments such as verbatim where the usual rules don't apply). It ends horizontal mode, causes TeX to break the horizontal text into lines placed on the current vertical list, and exercises the page breaker which may possibly cause the next page to be shipped out. \\ is different ... 79 The short answer is you use \verb where you need to write a small piece of inline verbatim material that contains characters TeX treats (or rather, is currently treating) as special. \texttt is for when you just want typewriter font. \verb has some downsides, such as not working in moving arguments. In those cases, you're probably better off using \texttt ... 52 I have no problem with publisher = {Harold \& Maude}, and running pdflatex and bibtex. 51 I think things are just a bit more complicated than in @Joseph's answer. (Though in laying them out, I may violate the desire for a "concise" answer.) My go to reference for details of the BibTeX format is Norman Walsh's page which self describes as: This help entry contains the same information as Appendix B of the LaTeX manual. In BibTeX's world ... 51 The tilde ~ is an unbreakable space, i.e. the line will never be broken at this position. If you write Table~\ref{...} the table number generated by \ref will always be on the same line as Table, which is the preferable formatting. Having "Table" at the end of a line and then "1" at the beginning of the next simply looks bad. The tilde is also used in names ... 50 General tips Use as few packages as possible, Call the packages in particular order, Use many small documents instead of one big one, Comment your code, Write readable code, Concentrate on the content, not on the appearance. General tips somewhat explained That's because packages tend to conflict and go obsolete. (See How to keep up with packages and ... 49 Anyone who's ever tried writing a simple perl (or whatever) script to quickly parse a LaTeX document and do something in maths mode but not in text mode will agree that $$..$$ is the only way to go! Trying to get the pattern matching right against$a^2 + b^2c^2 + d^2 is a nightmare. (Before anyone asks, yes I have, and it's called mathgrep. The pain ... 48 While listings package is good, it has some deficiencies, especially in Unicode support. I'd recommend trying out minted, which uses the output of Pygments, which is more likely to get grammar updates than listings. 47 Good approach is defining new environments for programming language. Minimal setup can be around this: \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} % Default fixed font does not support bold face \DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{12} % for bold \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{12} % for normal % Custom colors ... 43 The standard way of doing this is to use the listings package. It allows a wide range of formatting for the output, can choose to display only part of an input file and so on. The package also comes with a number of predefined languages it understands, including Python. 40 You can use a combination of \stackrel and \mathclap (from the mathtools package): \documentclass{article} \usepackage{mathtools} \newcommand\myeq{\stackrel{\mathclap{\normalfont\mbox{def}}}{=}} \begin{document} \begin{align*} a &\myeq b \\ &=c \\ &= d. \end{align*} \end{document} If using mathtools is not an option, you can use a ... 38 is plain TeX and could have some side effects, also fleqn will not work anymore. Please have a look at l2tabu. In my opinion the best environment for equations is gather or align. If you use equation you sometimes get some strange spacings.

38

You already got lots of answers. You can also just experiment yourself: \documentclass{article} \begin{document} Hello% world! \end{document} Try compiling this with and without the %. Then you see yourself that the % makes the space produced by the newline disappear. (Note that you'll still get the space if you write Hello % with a space before the % ...

37

Code should be readable and understandable. Using braces for all arguments, even if they aren't necessary, is more consistent. So, I prefer to use braces to not confuse unexperienced users. Leslie Lamport writes in LaTeX - A Document Preparation System: "Macho TeX programmers sometimes remove the braces around the first argument of \newcommand; don't do it ...

36

$((a\implies b) \land (c\implies a)) \implies (c \implies b)$ \land and \wedge are synonymous.

36

LaTeX's optional arguments viz TeX's macro arguments (delimited and undelimited) The LaTeX concept of optional arguments (i.e., arguments that may or may not been used) is a concept that is not directly supported by TeX's parsing and execution. TeX macros always expect the same number of arguments with the same syntax for delimiting the argument. Optional ...

34

Not equal can be written as: \neq

32

A percent sign, %, allows to end a line without generating a space character -- very useful when writing macros.

31


31

The syntax package from the mdwtools bundle has simple ways of typesetting BNF grammars, with some reasonable controls over how the rules are formatted. The space between grammar rules can be set with the \grammarparsep length. This is a rubber length, and defaults to 8pt plus 1pt minus 1pt. The distance between the left hand side of the production rule ...

31

There is a standard. It's a matter of opinion whether it's sensible or not, but it's been there since the release of LaTeX2e. Font aspect changing commands have two forms: action and declaration The same holds for abstract instruction such as "emphasize" Size changing commands have only the declarative form. Let me review the three points. Font aspect ...

30

With my LaTeX3 'hat' on, I'd like to give a slightly different perspective. This will overlap with the other answers, but hopefully will be useful. To follow this you need to understand 'tokens', I'm afraid. TeX turns input into tokens, and in particular control sequences such as \bar are single tokens. When Leslie Lamport designed LaTeX, he decided that ...

30

\documentclass{article} \catcode`\|=13 % make | active \def|#1|{\emph{#1}} \begin{document} This is an \emph{important} test. This is an |important| test. \end{document}

29

Historically there has been a lot of confusion over the two forms, (the situation with \phi and \varphi is similar but even more confused as at one point Unicode swapped the reference glyphs). I added a special section about epsilon to the XML/HTML entities spec http://www.w3.org/2003/entities/2007doc/#epsilon The situation in TeX is no different really, ...

Only top voted, non community-wiki answers of a minimum length are eligible