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
1
vote
2answers
45 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
462 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
84 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 ...
5
votes
2answers
274 views

Difference between \footnote and the pair \footnotemark and \footnotetext

Note: I accepted David Carlisle's answer because it was more accurate in what I asked, but I really recommend that you see DG's answer as he came up with a very powerful solution. I searched about ...
7
votes
2answers
443 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
48 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
54 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
189 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
42 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
117 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
47 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
99 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
62 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
52 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
227 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
399 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
123 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
61 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
44 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
181 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 ...
3
votes
2answers
681 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
504 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
125 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
97 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
87 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
96 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
111 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
67 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
65 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
141 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
121 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
585 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
37 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
129 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
49 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
75 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
64 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
85 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
49 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
80 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
161 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
290 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
149 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 ...
2
votes
0answers
39 views

braces or not braces in \NewDocumentCommand [duplicate]

I have a quite specific question and I haven't found it in the documentation of xparse or in the forum. In the documentation of xparse, page 3, there are three examples: \NewDocumentCommand{\foo}{o}...
2
votes
0answers
56 views

Writing a package: Best practices regarding dependencies

Some dependencies may be obvious and necessary for the basic function of a package. But what about secondary features which would require loading additional external packages? To clarify: I understand ...
9
votes
1answer
207 views

\lowercase trick vs. \gdef

In this MWE I define an environment where a particular letter is active with some meaning once with the \lowercase trick and once with \gdef: \documentclass{article} \begingroup \catcode`\A=\active \...
0
votes
2answers
211 views

Reducing white/empty space on page

I'm writing a thesis in Texmaker and use the documentclass "scrreprt". For designing a page I use the following code: \documentclass[fontsize=11pt,paper=a4,DIV=10,BCOR=12mm,oneside,toc=listof,toc=...
2
votes
0answers
45 views

METAFONT: When a letter is mostly repetition of another

I added a couple of letters to the logo font. beginlogochar("C",14); x3=leftstemloc; x1=x5=w-x3; x2=x4=.382[x3,x1]; top y1=h; y3=barheight; bot y5=0; y2=y1; y4=y5; draw z1--z2; draw z4--z5; ...

1
2 3 4 5
15