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

learn more… | top users | synonyms

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
91 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
162 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
344 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
464 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
53 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
94 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
107 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
72 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
139 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? ...
6
votes
0answers
374 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 ...
2
votes
1answer
246 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 ...
15
votes
3answers
1k 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
124 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
71 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
311 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
431 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
231 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
116 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
120 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} ...
6
votes
0answers
65 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
66 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
958 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
183 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
155 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
521 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
116 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{% ...
19
votes
2answers
4k 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" ...
7
votes
1answer
205 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
580 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
193 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
37 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
218 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
371 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
765 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 ...
106
votes
39answers
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 ...
9
votes
6answers
302 views

Create association lines between characters

I intend to create "association lines" between characters, where the start of the line is one or more characters inside a word, and the end of the line is a single character. Something like this ...
5
votes
1answer
184 views

What is the right way to cite @inproceedings with biblatex?

What is the right way to cite @inproceedings with biblatex? More specifically, many computer science proceedings paper citations seem to use book titles like "Proceedings of the 28th Annual ACM/IEEE ...
5
votes
2answers
290 views

Plotting R boxplots with pgfplots

I use quite a number of boxplots in my writing, and have chosen pgfplots as my plotting solution for a number of reasons (one of which is the benefit of having the data to build the plot in the tex ...
27
votes
1answer
273 views

Best practice for fixing a clash between packages without altering the .sty files?

Here is another casualty of TeX's flat namespace and another reason to start using LaTeX3... I noticed today that the algorithm2e and keystroke packages clash. More specifically, they both define a ...
4
votes
1answer
192 views

What is the right way to indent your source code?

This is probably a really basic question: When I write code, I want to achieve a logical and readable structure of the lines, where I can see which brace closes which brace. \begin{equation} ...
6
votes
4answers
239 views

Is there a better way to check divisibility in LaTeX?

I want to draw a trimmed ruler, for example, from 2.3cm to 3.9cm where the distance between two consecutive marks is 1mm. I have difficulty to efficiently check whether or not the counter is a ...
5
votes
1answer
108 views

How to get proper spacing when typesetting an expression such as $f\left(\frac{y}{2}\right)

I am trying to typeset the value of a function $f$ for $x = \frac{y}{2}$ (or something other which requires more vertical space). To get properly sized parentheses I tried: f\left(\frac{y}{2}\right) ...
4
votes
2answers
185 views

Macro names with one single figure like \2, a bad practice?

I know that it is not recommended to use macros like \H0 since it contains non-letters characters. However, what about the macro names like \2 with only one figure, which are allowed without trouble ...
5
votes
2answers
251 views

mdframed label multiply defined (with listings and paracol)

I use three packages (in a latex "book" document) to display source files (not only tex and sometimes loaded from external files) and their outputs (sometimes loaded from external files) side by side. ...
21
votes
4answers
730 views

Cleaning my TeX-code

I've recently finished my first paper written in LaTeX. I've gone through the code and tried to clean up and make it more reasonable - this is quite a challenge. I don't want you to actually ...