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

learn more… | top users | synonyms

9
votes
3answers
445 views

Inline math or \textit for author defined math constants?

Wondering if people here have a thought on what the best practice is here (if it matters). I used to use baskerville (well, the baskervald package) as my main font and charter as my math font (since ...
5
votes
3answers
150 views

When to break lines? [duplicate]

I am very new to LaTeX. A newline in the input file does not mean anything to LaTeX. An empty line in the input file means a new paragraph. Trouble is, when I view my sources with different text ...
36
votes
4answers
2k views

How does your mind bend \expandafter to its will?

Expansion is often cited as one of the most arcane aspects of TeX, more akin to witchcraft than to something easily picked up by the newcomer. There are many great questions and great answers about ...
5
votes
2answers
173 views

What packages are useful for (secondary school) teachers?

I'm trying to bring LaTeX to some of my colleague-teachers (in secondary schools, pupils 12->18 years old). They all seem quite reluctant to change. So I'm trying to collect some quick-win ...
4
votes
1answer
122 views

Difference between renewing commands before and after \begin{document}

I was wondering what could be reasons for differences when I redefine control sequences in the preamble or after \begin{document}? For example, this code typesets abcd when compiled by any of ...
5
votes
4answers
185 views

Simplify how I write my address in documents

Often when writing letters and articles, I need to print my address at the beginning or end of the document. I do this in the following ugly way: \documentclass{article} \begin{document} \noindent My ...
7
votes
4answers
529 views

How is the spirit of LaTeX different from writing in MS-Word? [closed]

I am learning the use of LaTeX by porting an 12-page LibreOffice Writer file to a set of pdflatex input files. The ability to separate the source in different files and later generate a single output ...
20
votes
1answer
278 views

What date should I specify in the optional argument of \NeedsTeXFormat?

Subsection 4.1 of LaTeX2e for class and package writers contains the following passage: \NeedsTeXFormat {⟨format-name⟩} [⟨release-date⟩] This command tells TeX that this file should be ...
3
votes
1answer
106 views

Way to remember LaTeX commands

I'm new to LaTeX but have already read so much about it. Now, as I write my first long document, I notice that my head can't process all of this new information ;) For example creating a float - and I ...
3
votes
1answer
63 views

Legend on every page

This is both a style question as well as a latex question: What is the preferred method of providing a legend for about 30 figures having a similar or the same legend in a thesis? Is it desirable ...
3
votes
0answers
33 views

Multiple \usepackage vs comma separated package names [duplicate]

What, if anything, is the difference between \usepackage{foo,bar} and \usepackage{foo} \usepackage{bar}
0
votes
1answer
99 views

Why is scaling text evil?

The TikZ & PGF manual says that It is possible to transform nodes, but, by default, transformations do not apply to nodes. The reason is that you usually do not want your text to be scaled ...
54
votes
4answers
3k views

Defining custom commands is bad style?

I recently received this in a e-mail from my professor Good LaTeX style would preclude creating any of your own commands, counters, etc. (Most journals would reject submissions with user-defined ...
3
votes
0answers
178 views

Typesetting programming packages/libraries in LaTeX

When referring to programming packages/libraries (such as matplotlib for example) within a LaTeX document should one typeset it to denote it as a package/library name? Such as using \texttt{}?
12
votes
1answer
404 views

Code improvement on a title page design

I am designing a new title page to post in the topic Showcase of beautiful title page done in TeX but am having some issues with the code I wrote. I don't like and I know it can be improved. In ...
23
votes
2answers
522 views

Multi-line options with the `\usepackage` command

When including a package using the \usepackage command that has a lot of options, are there: Any restrictions on how the options can be split across multiple lines? Any best practices for formatting ...
8
votes
1answer
56 views

Potential side-effects associated with a dash in a package/class name?

Common practice for naming packages and classes seems to be, using regex-like notation: [a-z][a-z0-9]* In other words, the name usually starts by a lowercase letter, followed by any sequence of ...
8
votes
1answer
101 views

Fixed position for pgfplot area

I use pgfplots to generate graphics for a beamer presentation. The graphics are placed on consecutive slides. This works great, but the graphic position is slightly moving from slide to slide, which ...
5
votes
1answer
122 views

Library of reusable equations

I want to do something that sounds simple. I want to create an external file where I will store my equations. Then I would like to be able to these equations and input them in a document without ...
6
votes
1answer
75 views

Font formatting order

I want to set my chapterprefix font for scrbook class. This is what I want to do: \setkomafont{chapterprefix}{\centering\Huge\rmfamily\mdseries\scshape} However, as I was writting it, I asked ...
5
votes
1answer
160 views

“Flatten” macros prior to sharing LaTeX file

Is there a way/an existing tool to process a LaTeX source document such that for a given list of macro definitions (using \newcommand), calls to those macros are replaced by their expanded version? ...
7
votes
0answers
538 views

best practice to include (standalone precompiled) graphics

General understanding I know that several people have asked about how to include plots and graphics (created by tikz and pstricks) into a latex document. What is the best way to include Matlab ...
46
votes
4answers
2k views

What is the advantage of using the notation 'fig:' in the \label {}?

Reading manuals I always find figure labeled as \label{fig:name}. I wonder where is the advantage of using this notation with fig:instead to start with the name it self. If in my document I have only ...
3
votes
1answer
297 views

Best practices in organizing BibDesk files

How many BibDesk files? I am using LaTeX (and BibDesk) for research only (i.e., to write papers, book chapters, dissertation, etc.), therefore I need to cite an overlapping selection of references ...
16
votes
3answers
2k views

Always \textrm, never \rm? A counterexample?

Let us see the following code: \documentclass{article} \begin{document} \newtheorem{theorem}{Theorem} \begin{theorem} TFAE \begin{itemize} \item[(i)] $0<1$; \item[(ii)] $1>0$. \end{itemize} ...
15
votes
1answer
137 views

Should babel package call be placed at the end of the preamble?

I remember to have read few year ago1 that babel line2 should be placed at the end of the preamble in order to avoid problems with other packages. (I believe hyperref package should also be placed at ...
2
votes
0answers
84 views

How to backup custom fonts and packages

I'm about to format my computer but I have installed a lot of TeX fonts and some useful TeX packages. I'd like to backup them, especially the fonts, because it took me a long long time to install but ...
13
votes
4answers
314 views

How do I tell which version of a command to use?

So LaTeX has a lot of commands that do very similar things. Often this is a result of some of these being old. For example: $x^2$ vs \(^2\); As I understand it, the second example is the more modern ...
10
votes
3answers
520 views

Empty line (in code) before enumerate environment

I like my code to look like this: \documentclass{article} \begin{document} \begin{enumerate} \item test text \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \item 5 ...
3
votes
1answer
58 views

The actual source of pst-plot?

In the comment to answer to his question Labels with \psplot Svend Tveskæg writes: The newest version of pst-plot can be found at http://texnik.dante.de/tex/generic/pst-plot/pst-plot.tex. Is it the ...
4
votes
1answer
303 views

Doubts for customize classicthesis

I downloaded the classicthesis from its site and I was analysing the contents of the class, the manual, examples and all that. But I have few doubts yet about how to customize well the classic thesis ...
4
votes
0answers
150 views

Long vs. short labels for cross-references

@DavidCarlisle argued in his answer that there is no need to use very long labels and it is actually a misuse! In my dissertation I find myself using very long labels all over the place. For the same ...
6
votes
1answer
125 views

Why to use [T2A, T1] when [T2A] is enough?

I am writing some seminar in Cyrillic for university \documentclass[a4paper,14pt]{extarticle} \usepackage[T2A,T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{droid} ...
8
votes
1answer
98 views

How to mimic LINQ's query method for macro's key-value?

Inspired by LINQ's query method, such as deck.Take(randomCount) .Where (card => card.Suit == "Hearts") .Skip(2) .Take(5) .OrderBy (card => card.FaceValue); The deck which is ...
5
votes
1answer
67 views

Should I use \documentclass[12pt]{article} with \Large or \documentclass{article} with \LARGE?

So, I'm working on making some cards, and they need to have nice, large, clear text. So I've set the text to be \LARGE. Then I was thinking, am I doing bad things to the font by over-enlarging it? It ...
12
votes
1answer
2k views

Use of \midrule in booktabs table

Are there any formal guidelines/suggestions on the use of \midrule inside a booktabs table with just rows of identically formatted data? The booktabs manual is very specific about vertical rules, ...
6
votes
1answer
204 views

How to format mathematical and programming variables in text?

I am describing an algorithm in a journal paper. In this algorithm I have a few variables. I gave them the same names as in my source code (C++ source of the algorithm, not LaTeX source). So I have ...
7
votes
1answer
166 views

Gobble optional arguments

You can use \@gobble, for instance, to restrict the usage of a macro like: \documentclass{article} \makeatletter \newcommand*{\cmd}[1]{% #1 \global\let\cmd\@gobble } \makeatother \begin{document} ...
6
votes
1answer
829 views

Typesetting chemical element names

What is the 'best' package for typesetting names of chemical element? (I don't need anything but the names of the chemical elements.) Assume I want to typeset ``The dissociation of a AgBr ...
5
votes
2answers
124 views

How to buffer the extreme value of f(x) to draw a line representing a range of f(x)?

Please consider the following animation. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot} \def\f{x^2-x-6} \psset{unit=3,algebraic} \def\Atom#1{% ...
21
votes
2answers
11k views

subfigure and subfig packages deprecated

I was using the subfigure package to align multiple small images in a document. However, WikiBooks states that "the subfigure and subfig packages are deprecated and shouldn't be used any more" ...
8
votes
1answer
340 views

Math mode horizontal space difference between \ (backslash) and \; (backslash semicolon) and what to use for multiplication

In this code: \documentclass{article} \begin{document} \begin{equation} c = a b \end{equation} \end{document} I would like to insert a space between 'a' and 'b' (as opposed to \cdot or \times). ...
18
votes
4answers
605 views

Is there any difference between quad in math mode and text mode?

Is there any difference between $a \text{\quad text\quad} b$ and $a \quad \text{text} \quad b$? I cannot see the difference as shown in the following figure. If there is no difference, which one ...
4
votes
1answer
224 views

Is there another style to make an \underbrace in big braces look elegant?

I don't think the following equation looks good because of the existence of the \underbrace. \documentclass[preview,border=12pt,varwidth]{standalone} \usepackage{amsmath} \begin{document} \[ ...
0
votes
0answers
41 views

Improve command definition to avoid possible break

The following defines my MWE: \documentclass{article} \usepackage{amsmath} \usepackage{totcount} \newcounter{totalpoints} \regtotcounter{totalpoints} \newcommand{\shcpoint}[1]{% ...
9
votes
1answer
244 views

What are your best practices to compile only a part of the document or presentation (or how do you prepare the big ones)?

I see that there a number of questions (A, B, C, D, E) on best practices, none of them answer the issue I am going to talk about. We all need to prepare large documents (or slides) from time-to-time. ...
6
votes
1answer
82 views

What is faster? To \RequirePackage{foo} or to check if the user has actually request it and \Require it if so?

I'm asking this because the package lineno has a thing that leaves a lot of commands in the .aux file (see here)... and I'm not sure if I should \newcommand these to empty or if I should just load the ...
31
votes
2answers
380 views

What are the standards of TeX/LaTeX coding in order to obtain robust packages?

I have posted several questions ultimately involving various aspects of robustness, that have arisen in the context of other questions in risk of clouding the main point of the question in each case. ...
9
votes
1answer
1k views

How to typeset LaTeX code inside a Table environment?

I wanted to typeset LaTeX code directly into my document, but without it doing something, i.e., I just want to show my code in the output. Now, I know there is the verbatim environment for code, as ...
119
votes
42answers
8k views

What are the most common mistakes that beginners of (La)TeX and Friends make?

I want to collect the most common mistakes, misconceptions, pitfalls, etc that (La)TeX and Friends users make. Please one answer for each mistake, misconception, pitfall, etc. I am only interested in ...