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

learn more… | top users | synonyms

4
votes
1answer
46 views

Vertical alignment of the `aligned` environment in table cells

I think most people will agree that the vertical alignment in the table cells below is less than ideal--especially if I want to remove the \cmidrule to be more in line with accepted "best practices" ...
11
votes
1answer
336 views

Organizing images for multiple latex files

This is kind of a soft question. In my work, I generate a lot of images (graphs with data, sketches of the experimental system, etc..) which I later use in various latex files (papers, beamer ...
14
votes
0answers
749 views

Best practice for typesetting physical quantities using siunitx [closed]

Consider the following example. Code \documentclass{article} \usepackage{amsmath} \usepackage[ locale=DE, output-product=\cdot, product-units=single % I use this option a lot in the document, ...
2
votes
0answers
46 views

How to throw an error and abort the compilation for the following scenario? [duplicate]

Objectives: I want to throw exceptions (or error messages) when the following illegal code is invoked. \const[c,any]{temp}{\f[\i]} \const[others]{temp}{\f[\i]} Minimal Working Example: I cannot ...
7
votes
2answers
186 views

How to parse optional arguments without keyval?

The current implementation only supports rounding with the specified digits in the optional arguments. \documentclass{beamer} \usepackage{multido} \usepackage{pstricks} \usepackage[nomessages]{fp} % ...
1
vote
1answer
131 views

What causes this error? [closed]

After seeing Herbert's answer, apparently this problem should not occur if I realized the first row of the following code should be \documentclass{beamer}. Problems often come from not knowing what I ...
4
votes
1answer
109 views

How to implement a constant declarating macro to behave differently in preamble and pspicture?

The example below is extremely trivial just to illustrate the problem in the simplest way. \documentclass{beamer} \usepackage[nomessages]{fp} % constants declarator \def\LoadConstants{}% to load ...
7
votes
2answers
916 views

Is usage of \ell instead of l in math mode best practice?

Is usage of \ell instead of l in math mode best practice?
5
votes
1answer
198 views

Best practice for typesetting Knuth's up-Arrow notation

What's the best practice to typeset Knuth's up-Arrow notation? \uparrow and \upuparrow are relation symbols (according to unimath-symbols.pdf). But in Knuth's up arrow notation, these should be a ...
5
votes
2answers
1k 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 ...
54
votes
12answers
3k views

How to practice LaTeX?

With many programming languages, you have the opportunity of practicing the language by doing problems or developing programs that will do certain things. With LaTeX, however, you can't exactly do ...
12
votes
1answer
194 views

Best Practice for creating user-defined command names

I want to let the users of a package define the name of command into which some unique content will be stuffed, so that they can then recall that content using the command name that they prefer. Is ...
4
votes
1answer
160 views

How to know the line width of enumeration in two column document prior to entering the enumeration?

I want to populate the following lengths just once prior to entering the enumeration (or perhaps prior to entering the document environment) to free me from worrying whether or not the ...
5
votes
1answer
142 views

Using \@-ified punctuation while using \frenchspacing

After reading this very informative TeX.SE thread about spacing and punctuation, I was left wondering about an issue that didn't seem to be addressed: using \frenchspacing together with the modified ...
13
votes
3answers
89 views

What to consider when naming labels to prevent errors?

This question is inspired by Umlauts in label and a quote from an answer to How to automatically add \! in subscripts? However the best is to avoid _ in labels. I already name all my labels with ...
2
votes
1answer
177 views

Which one is recommended to split, continue and align a long equation?

In my investigation, the outputs are identical as follows. Version 1: Using aligned. \begin{align*} \framebox[6cm]{Top LHS}\\ \framebox[5cm]{Middle LHS}\\ \framebox[4cm]{Bottom LHS} &= \! ...
3
votes
1answer
519 views

\twosides in KOMA - Why is my titlepage not centered

I'm using scrbook with the twosidesoption, and BCOR=10mm. The title page, being an odd page, has a large margin on the right, and a small margin on the left. I'm currently using the following to make ...
0
votes
2answers
98 views

If \section is followed by a \subsection, should there be nothing in between? [closed]

If \section is followed by a \subsection, should there be nothing in between? 2.1 The art of the bla some text 2.1.1 The details of bla blaaaa 2.1.2 Further details of bla blaaaaaaaaaa Is ...
15
votes
4answers
1k views

Good typesetting practice for long equations

I have the following (quite horrible) equation in my thesis: \begin{align*} \frac{\partial^2}{\partial t_1^2} f(t_0,t_1) = ( \delta+2t_0+2t_1)^{\alpha( w-t_0+t_1 )-1} \cdot \bigl( ...
13
votes
1answer
3k views

How should one maintain and update a MiKTeX installation?

Every once in a while after updating MiKTeX, the installation gets into an inconsistent state. This might be a problem with the packages (an example is described in this question), but sometimes ...
46
votes
5answers
5k views

Why use a package to typeset units?

I've seen a lot of posts about different packages for typesetting units and their relative strengths and weaknesses. Most posts seem to agree that the siunitx package is the most up to date package, ...
9
votes
3answers
489 views

Are there any downsides to using macros to avoid typing accents?

As a native English speaker, I am not used to many words with accents on them, so I find it somewhat difficult to keep the various accents straight in my head, and moreso to also remember the TeX ...
8
votes
2answers
184 views

How to make this pgfkeys code more compact and streamlined?

I have just managed to create my first command with pgfkeys. I defined a command \myset, whose purpose is to make (for example) \myset[big]{abc} correspond to \bigl\{abc\bigr\} Part of my goal ...
19
votes
2answers
353 views

Is it okay for a command to slurp more arguments than it is passed to?

Is it okay for a control sequence \foo to include another control sequence \slurp which slurps more arguments than \foo actually passes to it? For example, is it okay to do this: ...
2
votes
1answer
69 views

How to prevent preview from discarding my PostScript constants defined in the preamble?

Considerations: I have to use beamer document class to create a step-by-step tutorial. I have to use preview package to trim everything outside pspicture. Using standalone document class is not ...
3
votes
1answer
392 views

How to use commands in table specs, and still support array package?

For a package, I want to write code that creates tables, where the exact type of table is configurable (tabular, longtable, tabularx, ... [Update: David rightly remarked that formats like tabularx ...
3
votes
0answers
73 views

Best Practices For Including A Version Controlled File Across All Projects? [duplicate]

I am getting started with WinEdt 7.1 and TEX in general on a windows platform. I have a file where I've defined custom commands. Its current contents are: \newcommand{\avgE}{\bar{E}} ...
19
votes
4answers
2k views

git LaTeX and branches workflow

I'm getting more and more comfortable with git, and I'm learning how to use it with my LaTeX documents. However, I'm not at all a git wizard and thus I'm looking for further advices. One can find many ...
13
votes
4answers
286 views

What are the consideration when choosing either newcommand or newenvironment?

The first time I learnt LaTeX, I thought \newcommand properly fits for inline mode and \newenvironment for displayed mode. Later I noticed it is not correct. So the question is What is the rule of ...
17
votes
2answers
276 views

Does a single \path for drawing a series of geometrical objects make the compilation more efficent?

The TikZ syntax is so liberal (as mentioned in the documentation) that makes me a bit confused with which I have to adopt. Best practice is really my main consideration in coding anything. I have no ...
14
votes
1answer
143 views

Should I use packages when writing a class

I am trying to write a class based on the book class (a thesis class for my department). My question is: is it bad for some reason (or, is it considered bad) to use packages in the class files ...
45
votes
1answer
463 views

Is it always best practice to not include text punctuation in inline math mode?

It has been pointed out on this site, e.g. here by egreg, that text punctuation doesn't belong to the formula in inline math. I've been following this practice for a long time, so I write for all ...
31
votes
3answers
2k views

Best practice for hyperref link colours?

I'm using the hyperref package with the option colorlinks=true. However, I'm not happy with the default link colours: for instance, citation links appear in a flamboyantly bright green that hurts my ...
4
votes
3answers
205 views

Best way to present plain text results in a tex file?

I have some plain text results that I want to include into my bachelor thesis. The output looks like this: Protein: noname Length: 611 N-terminus: OUT Number of transmembrane helices: 3 ...
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
477 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
240 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
731 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
137 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
268 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
71 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
536 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
289 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) ...
26
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
217 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 ...
37
votes
3answers
8k 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?