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

learn more… | top users | synonyms

2
votes
1answer
39 views

What to use for itemize/enumerate/description type question

I have a lemma in which I want to say something like this: Let f be a function which satisfies either (A) f=0 and f is continuous, or (B) f=1 and f is well-defined. Then f is good. ...
62
votes
3answers
2k views

Detecting unused packages in LaTeX document

I have quite a bad habit of copy-and-pasting my packages from one LaTeX document to another. Is there any way we can detect unused packages (i.e. \usepackage commands) so that they can be removed from ...
3
votes
1answer
56 views

Hanging indentation of source code within sentence a la Vim-LaTeX-Box

I've recently been playing with the LaTex-Box plugin for Vim and noticed the layout of the source code on their Github page: What interests me is the 2-space hanging indent within each sentence. ...
46
votes
7answers
4k 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 ...
5
votes
1answer
62 views

Renaming \d for differentials

I know this question might sound dangerously like asking for an opinion, but I nevertheless give it a try. Since I never used the "underdot accent" \d I renamed it to get a differential in math mode ...
1
vote
0answers
26 views

Is there any difference between math mode and text mode for numbers? [duplicate]

Take the sentence: "The answer is 42". Is there any difference between The answer is $42$. and The answer is 42. In the final PDF I cannot see any difference. Does it make a difference whether I ...
8
votes
1answer
250 views

Gobble optional arguments

You can use \@gobble, for instance, to restrict the usage of a macro like: \documentclass{article} \makeatletter \newcommand*{\cmd}[1]{% \textbf{#1} \let\cmd\@gobble } \makeatother ...
10
votes
3answers
853 views

Inline math or \textit for author defined math constants?

Wondering if people here have a thought on what the best practice is here (if it matters). I used to use baskerville (well, the baskervald package) as my main font and charter as my math font (since ...
2
votes
0answers
34 views

(Is it wrong to) Use commands to begin and end equations (?) [duplicate]

I'm helping a professor write the second edition of his book, so I'm working with a lot of "old" code and bad practices. Something I've found is that he has defined macros for beginning and ending ...
56
votes
12answers
4k 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 ...
3
votes
1answer
1k views

How do you organize bibtex citations?

I use JabRef sofar on multiple files, each for a specific topic and then include all the needed (mostly all of them) at the end of file with a single line: \bibliography{bib/foo,bib/bar,..} ...
10
votes
1answer
272 views

Rule of thumb for synchronizing/updating Tex distributions

Some companies will not update their tex distribution regularly. What is a practical length of time to allow to pass before failing to resynchronize Tex Live or Miktex could reasonably become a ...
74
votes
6answers
4k 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 ...
11
votes
2answers
277 views

Which is better practice: rendering figures on the fly, or importing them as images?

I've come to a philosophical quandary with respect to my use of LaTeX for scientific writeups. At first I tried to render all figures in LaTeX at compile-time, for example making a graph using ...
12
votes
7answers
2k views

How do I get function argument parenthesis to position correctly?

I'm having trouble with the appearance of parentheses representing function arguments. They appear to far away from the function name. For example the code ...
0
votes
1answer
50 views

Properly writing an enumerated list in different lines within a sentence

My question is similar to this one but my items are bigger so I would like to write my items each in a different line. I am currently doing as follows The way to propose a solution that ...
3
votes
0answers
90 views

Pgfplots Boxplots with a thick line at the mean value

pgfplot produces nice looking plots, that have consistent look and feel. But sometimes you have a good reason to change that look, and I found it tricky to change style of an specific line, circle, ...
14
votes
1answer
379 views

Proper semantics for italicized foreign words and phrases

In English, foreign words and phrases such as per se and ibid. should be italicized, as shown here. There might be a number of ways to accomplish this in LaTeX: with \emph{per se} with \textit{per ...
5
votes
1answer
62 views

Math symbol in section heading

I have a section heading which includes an epsilon. Furthermore I am using the "hyperref" package to create links in my PDF document. When compiling I get a strange warning that a math symbol is not ...
7
votes
2answers
165 views

Temporarily changing catcode of %

Scenario I have a bunch of TeX files which may be processed by an external filter. The filter is (unfortunately) immutable: it does a string replacement where, for example, %d is expanded to a ...
4
votes
1answer
76 views

Math symbols in text mode

I need to write a text which contains some math symbols. In detail those include \rightarrow, \forall and \exists. I know I can switch into math mode with the $ symbol, but I have quite a lot of text ...
1
vote
1answer
86 views

“Good” command names for typesetting matrices and vectors

I usually add \newcommand{\M}[1]{\bm{#1}} % Matrix \newcommand{\V}[1]{\boldsymbol{\mathbf{#1}}} % Vector to my preambles. Short command names because I use them very often. Is ...
2
votes
3answers
67 views

How to fit a table with long header cells in “S”-type columns?

Well fit tables in LaTeX is hard for me, and I don't know if there is a manual with good practices about it. I need to create a table with S columns contending numbers, but the header of those columns ...
13
votes
3answers
242 views

Which packages should I recommend to postgraduates in different academic disciplines?

I'm preparing a list of package recommendations for an intermediate workshop on LaTeX. I avoided providing such a list at the introductory workshop as the tendency is to then add packages without ...
1
vote
0answers
83 views

How should I write math? [closed]

I'm new to TeX and I would like to use it to write math (on a Mac). I've just downloaded MacTex and I'm wondering what's the recommended workflow. Am I supposed to write math in TeX macros/code and ...
4
votes
1answer
98 views

Issues with nesting \textbf and \textit

I am trying to format a text so that it is bold and italic at the same time. I am doing this by nesting the \textbf and \textit commands, what should be no problem according to ...
13
votes
2answers
188 views

Should expl3 code be used in packages intended to be compatible with multiple formats?

Maybe this question is just not a good idea in general, but, I'm curious. This could make package development simpler for some in the future. (Of course, this would not be forced on any package ...
51
votes
5answers
14k 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. ...
8
votes
1answer
412 views

Is There Any Reason to Put Braces for Argument-less Commands (e.g. \int{})

Is there an reason/advantage for writing the integration (and other argumentless commands) as: \int{xdx} instead of \int xdx? I can see the first one gives a more comprehensible code, but are there ...
2
votes
1answer
93 views

Same pgfplots within standalone for usage in elsarticle and revtex4-1

Suppose I have created a plot with pgfplots for a scientific paper. However, for usual reasons the targeted journal is not certain. Possibly the plot has to be adjusted to match different journals ...
7
votes
1answer
4k 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 ...
4
votes
2answers
153 views

‘Correct’ way of writing a function?

So for all these years, I have been writing a function f(x) as $\mathop{f}(x)$. But now that I begin to think about a correct way of writing a function, what should it be? Is it f(x) or ...
119
votes
6answers
62k 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 ...
68
votes
5answers
11k views

Is there a preference of when to use \text and \mathrm?

I'm unsure of when it is preferable to use \text versus \mathrm, is there some unwritten rule about the use of these? For example, I saw the following code in a math post: ...
9
votes
1answer
449 views

Best Practice (Packages) for a Standard Technical Article With Math and Figures

I am interested in your opinion regarding the recommend packages for a standard technical document (Engineering, Physics). I normally use the following header: \documentclass{article} % Basic ...
21
votes
2answers
5k views

How to properly typeset footnotes/superscripts after punctuation marks?

I find the spacing of footnote marks after punctuation marks quite unsatisfactory, especially with sans serif fonts and compared to the spacing after letters. Example follows: I came up with a ...
14
votes
2answers
264 views

How to define a wrapper to a command that takes an optional argument?

What is the proper way to define a wrapper to a command which takes an optional argument (such as \chapter)? I mean a wrapper, not a clone, such that we can inject code into the wrapper without ...
8
votes
2answers
323 views

Is this sacrificial command a good idea?

I have this command: \newcommand{\name}[1]{\edef\name{#1}} You first call it as in \name{Don} and afterwards you can refer to Don using \name. Is this an accetable way to express a constant that ...
5
votes
2answers
563 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 ...
1
vote
0answers
43 views

What are the “best practices” when writing a thesis in Latex? [duplicate]

I am starting to write my master thesis in latex. So far I have only written article-like texts, so this is my first big document. I would like to start with some good general good practices. ...
11
votes
1answer
1k views

Typography and style - good choices for font styles in TikZ or pgfplots graphics?

When creating graphics or graphs with TikZ and/or pgfplots, one can put several commands to format the text to his likings. My question is: what are sound possibilities to format the elements in said ...
0
votes
1answer
112 views

How to Read/Edit tex files on an Ipad [duplicate]

I use LaTeX for writing books. I would like to extend my working environment and, I was wondering if it is possible to read (or much better - edit) tex files containing text only on an ipad? I know ...
7
votes
1answer
173 views

How can I make it easier to write LaTeX documents with elaborate mathematics?

I'm a severely visually handicapped student of mathematics. I wonder how I can speed up my latex document creation. I'm pasting below solution to a problem in a functional analysis book by Kreyszig. ...
2
votes
0answers
56 views

Policy to stress preferrable syntax

Question Assume someone wrote a LaTeX document using my package some time ago. I want to let him know that his code should be updated. The idea is to allow outdated syntax by the LaTeX compiler but ...
24
votes
2answers
21k 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" ...
6
votes
1answer
144 views

Best practice for biblatex, biber, utf8 files

I use biblatex and biber. I used to use bibtex. So, when I first started writing .bib files I would have entries like this: @article{descartes, Author = {Descartes, Ren{\'{e}}} Title = ...
3
votes
0answers
27 views

What is the best approach regarding .cfg files for the LaTeX graphics bundle?

The manual for the 'graphics' LaTeX bundle includes instructions for setting up the right conditions for the use of colour and the inclusion of graphics in documents. For example, on page 2, it says ...
2
votes
2answers
63 views

How to put information about the tool used to generate the document into the LaTeX file?

I am writing a tool which will (as one of its features) generate LaTeX documents from some input format. I would like to put an unobtrusive piece of information about the tool in the generated file ...
1
vote
0answers
48 views

Indexing the result of a lengthy matrix computation

this question relates to a problem about style or maybe convention. I have a matrix $M$ which is the result of a lengthy matrix computation (in my case: a long chain of matrix additions and ...
2
votes
1answer
121 views

Acronyms - Best practice to use during the text and create acronym page

I'm starting writing my PhD thesis in LaTeX however since I'm still at the beginning of the PhD I'm writing some pieces at the introduction, other at methods, sometimes the other way around. When I ...