A "best practice" is a technique or approach that TeXnicians recognize as giving better results than other approaches.

learn more… | top users | synonyms

21
votes
2answers
2k views

The TeXbook: Spiral or hard-cover binding?

I would like to purchase Donald Knuth's TeXbook, and I have noticed that there are two versions available. One is a spiral-bound edition, usually sold by itself. The other is a hard-cover edition, ...
57
votes
21answers
4k views

Do you use TeX for writing your thesis or only for its composition?

I would like to submit my university thesis composited in TeX. But I am not sure what is the best practise in the writing stage so I would like to ask you - do you write your thesis in a TeX editor or ...
7
votes
1answer
558 views

When should we use \DeclareMathSizes, \xxxstyle and font size changing macros (\tiny, \small, etc)?

Could you give me a complete overview when we should use \DeclareMathSizes, \xxxstyle (such as \scriptstyle, etc), and font size changing macros (\tiny, \small, etc)? I want this answer to be CW so ...
15
votes
1answer
246 views

What are best practices for package authors to deal with package conflicts?

One occasionally encountered problem with LaTeX is incompatibility between packages. What are best practices for package authors to deal with package conflicts? For example: What is the best way to ...
17
votes
1answer
845 views

Which command should I use for textual subscripts in math mode?

Textual subscripts like in W_{total} should be typeset in an upright text font (so that code isn't good practice), as has been discussed in various questions here. Now there are several ways to ...
4
votes
2answers
142 views

Why can't I insert a blank line in this code?

In the code below, everything is OK until I insert a blank line instead of one of the \\'s. Upon inserting a blank line, I'll get some errors. How can I get rid of these errors? ...
4
votes
2answers
291 views

Which one is preferred to write x-axis as a single unit that cannot be hyphenated?

Which one is preferred to write x-axis as a single unit that cannot be hyphenated by LaTeX? \documentclass[preview,varwidth]{standalone} \usepackage{amsmath} \begin{document} \preview Along the ...
2
votes
0answers
72 views

Is removing \ensuremath the best practice? [duplicate]

First of all, let's see the following dialogue. Generally speaking, is removing \ensuremath the best practice?
19
votes
1answer
560 views

Rationale to use \input{filename} on the pdflatex command line?

In a tex.SX user profile, I read the best practice recommendation Execute pdflatex \input{filename} instead of pdflatex filename. I have always used the latter one, directly, in scripts, and in ...
17
votes
1answer
291 views

What is the ConTeXt equivalent of LaTeX “\@.”

In English text, TeX follows the convention of putting extra space after a period by default, which I like. However, in the case of abbreviations it causes a problem. To suppress the extra space, ...
9
votes
1answer
1k views

Printing on A4 - standard classes vs. KOMA-Script classes

As I'm located in Europe the standard paper size is A4. So far I was normally using either \documentclass[a4paper]{article} or even simply \documentclass{article}. Recently I spotted sections (1.1) ...
30
votes
2answers
1k views

What are coding conventions in LaTeX?

What do I mean by Convention? First of all, allow me to clear myself about the word 'conventions. As most of you already know, coding conventions are a set of guidelines for a specific programming ...
15
votes
2answers
223 views

Macro Improvements

I am looking to simplify and improve on the code below: \documentclass{article} \usepackage{filecontents} \begin{filecontents}{test.txt} a an and the this by on of \end{filecontents} ...
14
votes
3answers
1k views

Macro for Declaring Variables in Class Files

I'm designing a new LaTeX class, and trying to write a convenient helper command for declaring new 'variables' for use in the class. Specifically, say I want to use a variable called \foo. I'd like ...
36
votes
7answers
2k views

Should I place \title, \author, \date in the preamble or after \begin{document}?

The motivation for this question Forgive me if this looks very basic to you but nobody has pointed out to me yet until now in a comment to a question that the \title command (and thus the other two ...
39
votes
3answers
9k views

Why use .sty files?

Why is it preferable to put inclusions of commonly used packages and user defined commands in a .sty file instead of putting them in an ordinary .tex file?
29
votes
1answer
3k views

When to use the xcolor package instead of the color package?

Can someone explain when to use the xcolor package instead of the color package? Unless you are creating your own specific colors, the differences between the packages seem to be fairly superficial. ...
13
votes
2answers
554 views

How to avoid nesting of tikzpicture?

I have to draw the probability distribution function (PDF) in the following MWE multiple times in a figure as well as across multiple figures. I have read the following questions: Problem with ...
3
votes
0answers
12k views

Where should I use \textsc? [closed]

When should I use macro \textsc ? What is common practice in document like diploma thesis? Should I use it for names of persons, names of described entities of particular interest or in some other ...
5
votes
1answer
9k views

Using Koma-Script's scrartcl class as an American academic: suggested changes?

It was recommended to me when I first started using LaTeX (not too long ago) and asked a question about footnotes to use Koma-Script's scrartcl class because of its /deffootnote command. Browsing ...
4
votes
0answers
63 views

Should I put the name of a new command in braces? [duplicate]

Possible Duplicate: Why do people use unnecessary braces? In so far as I know, the open and close braces around the command name for \newcommand{\commandname}{...} versus ...
9
votes
2answers
300 views

Best practices longtable

I have a long table with the explanation of 50 items (the MWE displays only 9). I believe this is hard to read. How do I make it easy to read? \documentclass[10pt,cleardoublepage=empty,twoside]{book} ...
10
votes
1answer
6k views

BibTeX or biblatex/Biber 'private communication' entry

What is the correct way to cite "private communications" and similar sources that seem not to belong into the .bib database. I am using biber and biblatex with TL2012
44
votes
1answer
4k views

What is the advantage of using $f^\prime$ instead of $f'$?

Although the two outputs look quite similar, what is the advantage of using $f^\prime$ instead of $f'$? By the way, here is my code: \documentclass‎{article‎}‎ \begin{document}‎‎‎ \[‎ ‎f^‎\prime ...
3
votes
1answer
139 views

How do I best combine several documents?

I have a collection of articles written in latex, and I would like to "merge" them into a larger thesis document, in which each article will be a chapter. I have been looking at include and input, ...
41
votes
6answers
4k views

Writing readable LaTeX

Lets say I have the following LaTeX code \subsection{Convex sets} A set \( \mathcal{S} \) in \( \mathbb{R}^n \) is said to be convex if \[ \mathbf{x}_1, \mathbf{x}_2 \in \mathcal{S} \implies \lambda ...
4
votes
1answer
159 views

Should I load packages (for instance, all AMS packages) separately or all together?

I was reading some post here at SE and I noticed that many people load packages one by one. For example, \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amsthm} and so on. Usually, I load ...
14
votes
6answers
9k views

How should imaginary numbers be typeset?

I've never had to typeset complex numbers before and I'm finding that I'm uncertain about what best-practices are. My question is really about typesetting just i. (Hence my title referring to ...
6
votes
1answer
186 views

Recreating a square with fixed baseline and height (3d)

I am trying to recreate the following image, as close as possible. The point is that the circumference of the bottom, plus the height of the cube needs to be 30. Which gives 30 = 4x + h so I want ...
4
votes
1answer
908 views

Tag placement in split equation within alignment block

Whenever I have an equation that does not fit on a single line, I am using \begin{equation}\begin{split}...\end{split}\end{equation} as recommended in the AMS math guide. This gives me an equation ...
3
votes
1answer
364 views

Example figure placement

I am using the following code in an example file. \documentclass{book} \usepackage{graphicx} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{figure}[h] ...
8
votes
1answer
6k views

Correct way to set margins

I set the margins of my document in this way using the geometry package \usepackage[left=2.5cm,top=3cm,right=2.5cm,bottom=3cm,bindingoffset=0.5cm]{geometry} Is it a correct way or does there exist ...
49
votes
3answers
9k views

What is the difference of \mathop, \operatorname and \DeclareMathOperator?

One sees all kind of versions in source files for defining something like a limit etc. So my question is which one serves what purpose. Is there any "best practice" in chosing one over the other?
5
votes
0answers
55 views

Review of algorithm-related packages? [duplicate]

Possible Duplicate: Print programs with its proper syntax Where can I find (if it exists) an updated review of the most relevant packages for handling with algorithms (pseudocode or code ...
40
votes
1answer
2k views

Difference between ref, varioref and cleveref. Decision for a thesis

How can one make a quick decision what the best "ref" for a thesis in pdflatex with hyperref is? After a few hours reading I do not know more than ref is used by everyone who does not know about ...
9
votes
2answers
170 views

Ensuring correct LaTeX compilation on different systems

I'm currently writing a document collaboratively and I need to make sure that the compilation is executed correctly on every possible system (e.g., that the document encoding - UTF-8 - is detected by ...
35
votes
2answers
2k views

Will cruft from a previous compile ever change the final look of my document

Ok, this has been bugging me for a while; Will cruft left over from a previous run of LaTeX ever change how my document looks? Would the following procedures ever give me different results: I ...
60
votes
2answers
12k views

When to use \par and when \\

What is the difference between \par and \\ and when should I use \par instead of \\?
13
votes
2answers
631 views

Why are these commands considered as bad practice?

I was reading LaTeX: Do not use these commands, but the author didn't explain why they are bad. Could anyone help me understand. \\ (except inside a special environment like tabular, array, or ...
56
votes
6answers
2k views

How bad for TeX is omitting braces {}, even if the result is the same?

Sometimes writing braces and omitting them produces the same result: \tilde{\psi} \mathrm{e}^{\mathrm{i} \pi} vs \tilde \psi \mathrm e^{\mathrm i \pi} Or (taken from Werner's comment below) ...
4
votes
3answers
208 views

Shorthand for variables lead to name clash

In formulas I need often the same constants and variables with lot of "make-up". I want to have readable and maintainable LaTeX code, so I thought about writing \newcommands like ...
6
votes
1answer
369 views

Newline, indentation, parskip - when to use what in what stylistic manner?

I intend to use scrbook. In real-life literature, English and German language, the text often looks like this: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod ...
59
votes
2answers
1k views

Detecting unused packages in LaTeX document

I have quite a bad habit of copy-and-pasting my packages from one LaTeX document to another. Is there any way we can detect unused packages (i.e. \usepackage commands) so that they can be removed from ...
8
votes
1answer
386 views

Can I assume that the \ht+\dp of a strutbox == \baselineskip?

In Context, as long as the interline space is set through the proper interface, it is safe to assume that (tex.box.strutbox.height + tex.box.strutbox.depth) == tex.baselineskip.width. This relation is ...
5
votes
1answer
779 views

Shortcut commands for referencing floats

I always include the following commands in the preamble of my latex documents to make sure I refer to floats consistently in the text. I was wondering if the community had any thoughts about this, is ...
17
votes
1answer
218 views

Is there a right way to do combined conditionals in LaTeX3?

I have some LaTeX3 code and I want to add a new feature. This will involve choosing between various actions at a particular point. There are two choices to be made, and these choices are ...
10
votes
2answers
753 views

Are there any situtations where it is better to load a package after other code?

I always place all my packages immediately following the document class, followed by setting information (\hypersetup for example) and customization to my documents (header and footer customization ...
1
vote
1answer
2k views

How should I write arctanh? [duplicate]

Possible Duplicate: Define additional math operators to be typeset in roman If I want to use the function sin in LaTeX, I write $\sin x$ or $\sin(x+1)$. If I want to use the function ...
6
votes
3answers
254 views

Without using intersection method, can we find the following vector component?

Given that two vectors, i.e., green and red ones. The objective is to find the blue one such that the resultant of the green and blue ones is parallel to the red one and with the same direction as the ...
33
votes
3answers
1k views

How to make TikZ faster?

I have a long document containing plenty of TikZ figures and it is painfully slow to compile it. Is there any specific TikZ tips / good practices you could recommend me so that I can write figures ...