Questions tagged [best-practices]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
26 views

When to use tabularx vs. tabular? [duplicate]

As mentioned in the title, I was wondering if anyone can point me to a guide on when to use tabularx and when to use tabular (or tabular*). Based on my limited knowledge and posts like LaTeX tables ...
4
votes
1answer
56 views

Removing math italic correction: Should kern stay outside or go inside of subscript field?

Sometimes it is desirable to remove the automatic italic correction appended after a math object (e.g., any ordinary math letter, the integral sign, etc.) while in math mode. Applications include: ...
223
votes
2answers
153k views

When to use \par and when \\, \newline, or blank lines

What is the difference between \par, \newline, \\ and blank lines? When should I use which one?
347
votes
10answers
68k views

Are \( and \) preferable to dollar signs for math mode?

Along the lines of Why is \[ ... \] preferable to $$ ... $$?, what reasons are there (if any) to favor \( ... \) over $ ... $?
84
votes
1answer
9k views

On the basics of writing to & reading from auxiliary files (.aux, .toc, etc.)

Some actions (such as generating the Table of Contents) require two passes of the TeX compiler: during the first pass, some data get written to an auxiliary file, only to be retrieved during the ...
215
votes
6answers
212k views

utf8x vs. utf8 (inputenc)

I normally use \usepackage[utf8]{inputenc} for my latex document but on this site i saw a lot of code with \usepackage[utf8x]{inputenc}. What are the differences between the 2 options ? Is there one ...
1
vote
1answer
68 views

Why I can't use \unit command in siunitx?

Most of the time I work with siunitx package I need to specify only units like: "give the answer in psia". For achieving this every time I try with \unit{\watt} (W for example) but it ...
76
votes
9answers
70k views

Footnotes in tables?

I would like to have footnotes in tables, but the \footnote command does not work inside a table environment. Googling one finds that this is a frequently asked question, at least in the UK. That ...
33
votes
5answers
7k views

Best practices for source file line lengths?

Are there any best practices for how long to make your lines in your source file? I'm also interested if there are best practices for it if there aren't any LaTeX-specific best practices. I ...
6
votes
2answers
372 views

Difference between \footnote and the pair \footnotemark and \footnotetext

Note: DG's answer is the practical solution for the problem, but I recommend you to also see David Carlisle's answer since it talks about the problem. I searched about this for a while, but I couldn'...
2
votes
1answer
56 views

How to use str_foldcase in the preamble without generating a missing begin document error

Edit Thanks to @PhelypeOleinik for pointing out the problem wasn't the \str_foldcase itself but the switch statement bodies trying to typeset text before the document has begun. The cognitive overload ...
1
vote
0answers
42 views

What could go wrong with putting a tikzmark node around an existing box just before unboxing it?

I've an idle thought on how to use the dastardly tikzmark TikZ library to put nodes around pre-packaged boxes, specifically (but not limited to) the boxes that the awesome AMSMath packages use when ...
67
votes
2answers
65k views

typesetting modulus operator, as in remainder

Is there a standard way to typeset the modulus operator (as in arithmetic remainder)? The percent sign (%) is often used by programming languages and mathematicians tend to use mod, but because of the ...
1
vote
1answer
88 views

scalebox or new font switch to create specific font size?

I want to set a small portion of text in a font size not covered by the standard font switches and found two ways to do so: Define a new font switch: \newcommand\newfs{\fontsize{48}{60}\selectfont}, ...
206
votes
2answers
359k views

How to write conditional equations with one-sided curly brackets [duplicate]

I want to write a conditional expression such as the following. What is the best way to express such conditional expressions in Latex?
89
votes
13answers
28k views

What are the advantages of using version control (git, etc.) in LaTeX documents

Why would I need to use version control with my LaTeX documents? I know people who do it, and I've seen questions about it on here and on SO, but I haven't understood what value there is to doing it......
13
votes
1answer
3k views

Why should I ever use equation when I can always use align? [duplicate]

Is there any reason why I should use equation when I align seems to produce the same output? The reason I am asking is that I like solving math using LaTeX. Sometimes I write a single equation using ...
7
votes
1answer
405 views

Is it bad practice to replace a^{-1} with a user-defined command?

I've recently started doing my homework in LaTeX, so I'm still very new to this world. One of the things I don't very much like doing is typing out ^{-1} everytime I want the inverse of something, so ...
8
votes
1answer
168 views

Is it good practice to use a custom command for logical (consistent) markup of functions?

I am only recently learning about the importance of being consistent with markup when typesetting a document in LaTeX (Separate content from formatting - i.e., "just type"). For instance, \...
1
vote
2answers
46 views

best practices for passing arguments to commands or macros

I implemented some commands/macros recently and I'm thinking about reducing the number of arguments given to a command/macro. Basically, until now I have created some macros with xparse or \cs_new:N ...
6
votes
2answers
485 views

How to decide if a comma or punctuation between math mode content should be inside math mode or in text mode?

Which of the two is the preferred way of writing LaTeX code that has punctuation between math mode content? Example 1: Therefore the solutions to the given equation are \( 2 \), \( 4 \), \( 6 \), \( 8 ...
35
votes
6answers
9k views

Which equations should be numbered? [closed]

Is the best practice to number all equations, or just those that will be referred to?
10
votes
4answers
1k views

Any way to bundle some variables in an OOP-like object in LaTeX?

I would very much like to have one object encapsulate a bunch of data, and then pass that object to a function. For example, a figure might have an URL to a file, a caption, and a width. In Python, ...
4
votes
1answer
1k views

Good practice rules for writing clean LaTeX?

Are there good practice rules for writing clean LaTeX? Something like PEP8 for Python. Examples: spaces or tabs (not a troll) ; how many columns before wrapping (80 for PEP8 compliant Python) ; ...
2
votes
3answers
158 views

Should I use cdots or ldots for an enumerated product?

What would be typografically right? a_1 \cdot a_2 \cdots a_n or a_1 \cdot a_2 \cdot \ldots \cdot a_n
4
votes
1answer
87 views

Proof environments inside statements - is it harmful or is it OK?

I discovered that a student of mine uses constructs like \begin{theorem} ...a statement... \begin{proof} ...proof of that statement... \end{proof} \end{theorem} My first reaction was ...
11
votes
2answers
18k views

Professional slashbox alternative

Suppose I have the following table which lists conversion rules, where rows denote the input and columns denote the output type (so, for example, the conversion int8_t -> int16_t would use b, while ...
7
votes
2answers
494 views

LaTeX Convention for displaymath

I'm interested in where the convention for using the backslash-bracket (\[ ... \]) for math display environments originates. I really can't stand slash-bracket notation because most people write it on ...
109
votes
6answers
9k views

How to keep up with packages and know which ones are obsolete?

I'm an on and off user of LaTeX so I'm not familiar with every package out there. Having said that, whenever I use LaTeX and need to accomplish a certain goal (i.e. generate a list of appendices), I ...
4
votes
1answer
116 views

including logos with different colors

I would like to set up a package with some logos for titles and fancy headers and the like. The key problem that I have at this point is that it should be possible to get the logo in different colors. ...
1
vote
2answers
59 views

math operator spacing when used with delimiter modifiers such as \left \right, \big \Big etc

I noticed that using any delimiter modifiers like \left( \right) or \big( \Big( etc after a math operator like \cos inserts a small horizontal space. This question suggests that one simply not use ...
2
votes
2answers
57 views

Aligning multiline formula: Break within fences and AMS style

I have a rather long formula and I would like to align it in accordance with AMS Style Guide (see below screenshot from page 119). I am not able to reproduce this behavior. Here is a minimal working ...
127
votes
6answers
89k views

Should I \mathrm the d in my integrals?

When writing an integral, it seems like something should be done to separate the "d", as in \int f(x) dx, so as not to confuse it with a variable. I've seen it left as-is, bolded, and straightened. ...
5
votes
2answers
197 views

How can I add line breaks to the end of a macro?

I want to simplify the writing of this content, which should appear tabulated. I've written two macros to indent and colored ℣ and ℟. And I want to avoid having to always write \par at the end of each ...
1
vote
0answers
43 views

What's a good way to add a non tex table from external file?

I'm seeking for your advice and ideas regarding a way to add all my tables in the pdf file as non tex files. The goal is to make it harder (much harder) for someone to edit the way the tables look in ...
1
vote
1answer
278 views

Spacing between columns in the amsmath's cases environment

As most of you may already know, the amsmath package provides a cases environment. As the example in the user guide indicates, the typical usage of the environment is to construct a formula with ...
58
votes
8answers
11k 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 ...
134
votes
3answers
47k 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?
3
votes
1answer
50 views

Should you use bibtex entries from the source?

I wish to cite this article. A bibtex entry can be downloaded directly, which is as follows: @inbook{Kleinhenz2017, author = {Julie E. Kleinhenz and Aaron Paz}, title = {An {ISRU} propellant ...
1
vote
2answers
109 views

siunitx: share the same value with two different units

If I have two different constants share the same value at some condition, what is the better way to aesthetically present this information than typing the two units after each other? For example, I ...
3
votes
1answer
69 views

How do I add the value of a token list with braces in LaTeX?

In my LaTeX3 code, I frequently find myself wanting to add the value of one token list (or other variable) to another but surrounded by braces (a common use case is where I'm constructing a command to ...
9
votes
1answer
2k views

Can I temporarily disable the @@ replacement in LaTeX3?

I'm trying to write my L3 packages using good practice, which I understand involves using @@ in defining command and variable names which then get replaced by the module name (Section 3.2.2 in texdoc ...
2
votes
1answer
55 views

Is this the best way to label the lanthanides using chemnum?

I want to label a series of compounds with the lanthanides, i.e. 10la and I'm using the chemnum package. The manual gives some hints about this, saying you could do \newcmpdcounterformat{arabic}{\@...
4
votes
2answers
315 views

Best practices for typesetting a math document and its building blocks (definitions, theorems, lemmata)?

This is admittedly a soft question and, to make things worse, the goal of my question might even be controversial. Please bear with me, though. I'm writing a long math paper with hundreds of math ...
57
votes
8answers
90k views

How to best typeset "special" constants (complex unit i, Euler's number e,...)?

I'm trying to come up with a typographically appealing way to express "special" numbers such as the complex unit i = sqrt(-1) or Euler's number e. It has to be such that it cannot be confused with ...
0
votes
1answer
320 views

Templates or tutorials for creating a title page

I am relatively new to Latex. I am writing my thesis in Latex, which has been (as you know) so much more convenient than a word processor. I am using \documentclass[oneside,11pt]{book} along with the ...
4
votes
1answer
1k views

Aesthetically, which font should I use when I want to use Euler Math fonts?

So the question is of an aesthetics "best practice" type. I know that I shouldn't use Euler math fonts with the standard Computer Modern, and I'm struggling to find a suitable typeface where I can use ...
0
votes
1answer
166 views

Best practises: How to write the category R-mod

What are the best practises for writing the category R-mod of modules over the ring R? Importantly, how should I write the dash? Is a text mode dash my only option, or is there a math mode workaround? ...
92
votes
4answers
19k views

What is the proper use of \@ (i.e., backslash-at)?

In this answer, \@ is used after a period and before an \xspace, presumably to indicate that the preceding period (in "etc.") was not sentence-final. In these tips, \@ is used before a period and ...
0
votes
0answers
66 views

LaTeX exercises

Recently I've learning more about LaTeX and I would like to know where can I found exercises and documents to replicate in order to improve my skills.

1
2 3 4 5
15