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

learn more… | top users | synonyms

8
votes
2answers
252 views

Finding the depth of nesting in a macro call

Is there a general way to find the depth of a macro evaluation? For example, consider the following script, \documentclass{beamer} \usepackage{mathtools} \usepackage{calc} \begin{document} ...
7
votes
1answer
166 views

auto-pst-pdf or pdftricks2?

When I compile a LaTeX documents containing PSTricks code, I normally use the package auto-pst-pdf, but recently I found pdftricks2. Should I use auto-pst-pdf or pdftricks2 and what are the ...
4
votes
2answers
213 views

Inheriting from beamer

I'm trying to write (my first) document class which will be an extension of beamer. In particular I want this class to produce the slides that I like. One of the things that I want is to have a ...
24
votes
3answers
2k views

What is the difference between unicode-math and mathspec?

I'm currently typesetting my lecture notes for classical electrodynamics using the tufte-book class and XeLaTeX. This is my first time using XeLaTeX and so I stumbled upon the two packages ...
3
votes
1answer
100 views

Difference between bibliography management styles

There are two ways that I've seen people including their bibliographies. The first is without including any package: % Document: \bibliographystyle{ieeetr} \bibliography{<file>} And the ...
5
votes
1answer
530 views

Quotation marks: Is there any difference between \grqq/\glqq and “` / ”'?

I am currently employed at university to proof-read lecture notes. This means I read quite a lot of text and correct language errors / wrong references to tables / images, but I also try to improve ...
8
votes
2answers
117 views

Line breaking with `and/or` + babel

I have continuously come up with the problem of overfull hboxes because sometimes I write and/or in my papers. For example, this phrase: To design and implement a biofeedback system for alerting ...
16
votes
2answers
355 views

Should I make a package or class for my usual preamble, or include it in every document?

This TeX.SE thread is a good resource for how to make your usual preamble into a package or document class. I would like to know why I should do that. What are the pros and cons of doing so, as ...
11
votes
2answers
200 views

What is the best practice for arithmetic operations specially for package/class writing?

There are some possibilities to execute arithmetic operations inside a package or class. TeX TeX supports \advance, \multiply or \divide to execute arithmetic operations. However the syntax is more ...
45
votes
1answer
1k 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 ...
31
votes
1answer
1k views

Best practice for writing comments in LaTeX documents

I would like to find out about recommended practices when using comments in LaTeX documents. Some programming languages are quite clear about how to use comments in source code: for instance, [here] ...
12
votes
5answers
2k views

Best practice for typesetting quantifiers?

When I work with quantifiers I noted that are very close to the other symbols and the result does not look good, for example $\exists a\in\mathbb{R}\exists b\in\mathbb{R}\forall c\in\mathbb{R}\forall ...
6
votes
1answer
126 views

How to remove the white space on the top of the following table?

How to remove the white space on the top of the following table? \documentclass[preview,border=0pt,varwidth]{standalone} \usepackage[table]{xcolor} \usepackage{array} \usepackage{longtable} ...
16
votes
3answers
266 views

Defining Extensible macros

Question: For a macro that has only one parameter, are there any issues with defining it as follows: \NewDocumentCommand{\MyMacro}{% s% #1 = starred variant (*** unused as of yet ...
8
votes
3answers
461 views

Parallel lines on a grid and circle best practices?

I am a TeX/LaTeX noob, but I am learning rapidly. I am about to attempt to draw the following figure using LaTeX/TeX/TikZ I already have a, (I think) good working knowledge of how to draw circles, ...
3
votes
2answers
636 views

Table layout: cells with short and long text

I've been fiddling with a table layout where some cells contain very little text while others may need multiple lines, and I can't seem to get it readable and nice-looking. MWE: ...
4
votes
1answer
52 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
355 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
794 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
47 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
192 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
134 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
112 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
1k 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?
6
votes
1answer
216 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
205 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
163 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
144 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 ...
14
votes
3answers
92 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
193 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
564 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
101 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 ...
47
votes
5answers
7k 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
538 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
355 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
70 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
430 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
74 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
303 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
279 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
146 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
470 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 ...
32
votes
3answers
3k 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
210 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 ...