Tagged Questions

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

learn more… | top users | synonyms

16
votes
2answers
345 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
195 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 ...
42
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
125 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
263 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
452 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
605 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
49 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
347 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
773 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
188 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
133 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
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
210 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
199 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
162 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
90 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
187 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
539 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
100 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
6k 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
521 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
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
414 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
293 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
278 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
468 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
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
206 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
516 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
244 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
788 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
141 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
276 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 ...