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: ...
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 ...
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 ...
1
vote
2answers
47 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
486 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 ...
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 ...
6
votes
2answers
376 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'...
7
votes
2answers
496 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 ...
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 ...
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
44 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 ...
2
votes
3answers
160 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
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}{\@...
0
votes
1answer
323 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 ...
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 ...
0
votes
1answer
168 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? ...
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.
2
votes
2answers
48 views

What is the best approach to align equations in order to organize common terms in a equation? (aligned vs array) [closed]

This question is about opinions and experiences of users. What is the best approach to align equations in order to organize common terms in a equation? What is preferable in the particular case ...
7
votes
0answers
204 views

Redefining Commands: Safety and Best Practices

There's plenty of questions on this site about redefining specific commands, but I couldn't find a more general, comprehensive question about the safety and best practices of redefining commands in ...
4
votes
2answers
769 views

Best practice for plots (pgfplots, gnuplot, etc.)

I am writing a fairly large article with a lot of different plots. They range from simple ones like abs(x) or x^2 to high-polynomials with their first and second derivative, and nonlinearities (...
11
votes
1answer
529 views

Reasons not to use \newcommand{{...}} (with double curly braces)

Which are the reasons not to always use \newcommand{\stuffa}{{STUFF}} instead of \newcommand{\stuffb}{STUFF}? In which cases would the former be a bad idea? The reason I am considering doing this is ...
1
vote
1answer
144 views

Correct spacing rules for functions in math mode

I have a question about spacing in math mode. Suppose you have a document that contains many times the nabla symbol. I have read in different answers in this website that it is advisable to write \...
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. ...
3
votes
1answer
88 views

How to know when to use \left( and \right) and when not to?

How to decide when \left( and \right) are necessary? Here is my code that shows various ways to format the same formulae: \documentclass{article} \begin{document} Example 1.1: \[ \frac12 \left( p +...
1
vote
2answers
98 views

Is it better to use Asymptote in-document vs compiling separately?

I write files with a fair amount of Asymptote in them and I have developed the habit of writing the asy code in a separate file, rendering it as a pdf (usually; sometimes it's a different format), and ...
1
vote
2answers
130 views

Is it considered bad practice to use both Asymptote and TikZ in the same document?

I'm something of a beginner in both Asymptote and PGF/TikZ, but I'm a bit better at Asymptote, and so I generally find Asymptote easier to use. However, I find Bezier curves a bit easier to control ...
2
votes
1answer
73 views

How to deal with empty values in command arguments

In this MWE, a command argument is directly passed to an environment. That works fine with empty values: \documentclass{article} \newcommand{\minipag}[1]{% \begin{minipage}[b][#1][b]{6em} One ...
1
vote
2answers
70 views

How to make a command take effect on all elements in a row of a table?

I am thinking about something similar to \rowfont of tabu package or \rowcolor of xcolor, but to work in the tabular standard environment. I have no idea if it is a reasonable wish, like in the case ...
4
votes
0answers
185 views

When is \ensuremath really needed?

A rather popular question is When not to use \ensuremath for math macro?. Some good answers there explain why \ensuremath is often overused. egreg has an "\ensuremath-only-when-really-needed campaign"....
0
votes
0answers
148 views

Is it alright to use \newcommand inside of the body of a document?

This document compiles fine. \documentclass{article} \begin{document} \newcommand{\foo}{bar} \foo \end{document} But like, this feels wrong or immoral or something. Is there any specific reason ...
3
votes
1answer
706 views

Is \leqq or \leq preferred over ≦?

I think there is no problem writing $a < b$. Is there a problem with writing $a≦b$ instead of $a \leqq b$?
0
votes
0answers
39 views

How to markup GUI menu commands

I am writing user documentation for custom software, and am wondering if there is a built-in command, library, or "best practice" for marking up GUI commands semantically? The idea is something along ...
0
votes
2answers
138 views

How can I make a single file of the packages I use? [duplicate]

Good morning, I would like to know whether someone can help me with this: I need to learn how can make style file archive.sty, because in the preamble of my source file I have to write all packages ...
1
vote
2answers
55 views

Best practise: Using description environment for case differentiation

Is it semantically correct to use the description environment for case differentiation in a proof? Actually, it doesn‘t seem that a description fit, does it? But it looks correct to me. If it‘s not ...
1
vote
0answers
77 views

Is there an authoritative resource on generally accepted LaTeX usage standards (or at least generally accepted best practices)?

I have been basically "hacking" with LaTeX so far, trying out things that seem to visually give the result I want, and using google to find solutions. However, I have heard people say that certain ...
1
vote
1answer
53 views

What is the best way to show the following picture?

I am looking for best practice in showing the following picture. I would like to show equivalent fractions and need to display the operation for numerators and denominators. I have to hardcode the ...
0
votes
0answers
65 views

A macro to automatically show the steps to solve equations with conditions for positive or negative addends

I would like to design a macro so that I can solve an algebra equation such as 2(x-3)=14 and show the steps. Here is what I have that seems to work but I am pretty sure its not best practice. \...
2
votes
1answer
88 views

I'm trying to automate some solving equations in a macro

I'm trying to write a macro that will solve a simple linear equation and show all the steps but I"m having trouble writing a macro. I'm resorting to copy and paste in every section. Here is what I ...
1
vote
1answer
52 views

Defining consistency checks for the content of larger documents

Many of us have encountered this: you're writing a larger paper / proposal / book, possibly collaboratively with multiple authors with different writing styles or English flavors/flavours, ending up ...
3
votes
1answer
81 views

Best practices for commenting/documenting a project?

I'm very new to LaTeX and I'm working with a large document created by several other people. It's been very difficult to parse, (some sections have indexing, inconsistent formatting, etc). What's the ...
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, \...
4
votes
2answers
316 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 ...
3
votes
3answers
153 views

Mingled math and text in math mode

I frequently encounter the situation of wanting to, say, write a set where the set-membership condition involves some text. If I wanted to describe, say, the set of all even integers this way, then ...

1
2 3 4 5
15