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
1answer
32 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
46 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
28 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 ...
6
votes
0answers
109 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
375 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
453 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
42 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 \...
3
votes
0answers
52 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. ...
2
votes
1answer
81 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 +...
0
votes
2answers
75 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 ...
0
votes
2answers
84 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
38 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
57 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
60 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
56 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
247 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
31 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
80 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
41 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
66 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
44 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
55 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
76 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
39 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
65 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
123 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, \...
3
votes
1answer
150 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
139 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
36 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
49 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 ...
0
votes
0answers
32 views

Colored margin vertical text

I'm using the below code to create colored margin. but instead of the chapter name I would like to have the section name. Can you help me please? \documentclass{book} \usepackage{lipsum} \usepackage[ ...
9
votes
1answer
180 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
76 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
44 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; ...
2
votes
1answer
93 views

Collaborating with biblatex

This answer says that my TeX editor (TeXstudio) is choosing a bibliography tool for me. But it seems that I have to make the biblatex backend match this bibliography tool in source code for my ...
4
votes
1answer
82 views

expl3 replacement for \lowercase trick

Given this example code: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \group_begin: \char_set_catcode_active:n { `\* } \cs_new_protected:Npn \foo #1 { \group_begin: \...
1
vote
1answer
97 views

Should I define expl3 functions with an explicit parameter list when I don't need to?

I am currently attempting to learn expl3 and reading interface3.pdf. Thanks to the argument expansion control provided by l3expan, I will not have to define functions with "weird" arguments very often....
2
votes
2answers
43 views

What's the best method for bracing a list of aligned equations?

I would like to reduce the height of the \left\{ in the following, to make it the same height as the equations: %\usepackage{esdiff} \begin{align*} \mathcal L&= - 0.75 w(S) - 0.25 w(F) + \lambda ...
2
votes
0answers
121 views

Does it make sense to define commands like “\xa” to type “$X_1$”? [closed]

i.e. in the preamble defining some command like \newcommand{\xa}{$X_1$} I realize this question doesn't have a definite answer -- it is a personal preference kind of thing -- I am just curious if ...
0
votes
0answers
27 views

Setting defaults with keyval-interface - do it in the current scope or do it globally?

Assume a LaTeX 2e-macro, be it named \foo, which processes the content of one optional argument via keyval-syntax. E.g., \foo[key1=value1, key2=value2,...,\keyN=valueN] I would also like to have a ...
17
votes
2answers
391 views

Are there guidelines for finding good names for LaTeX 2e packages and control sequences defined in these packages?

I have written some code which I would like to submit to CTAN as a package for LaTeX 2e. (readme, dtx, ins, pdf with manual and commented sources.) I need a good name for the package. Question: Are ...
1
vote
1answer
239 views

The LaTeX syntax for this probabilistic formula

I would like to create a math formula as follows. How do I write it in LaTeX?
10
votes
3answers
309 views

Best practice for printing and evaluating formulas with the minimal coding

Can the following MWE be reduced by creating a command that can accept a formula then print and evaluate it without the need to write it twice in two different forms for both evaluating and printing ...
5
votes
1answer
154 views

Is there a simple/elegant way to color atom groups in chemfig?

I have a lot of molecules to draw. For teaching purposes I need to color certain atoms or group of atoms. Due to alignment of the main chain, I'm using a | symbol after each atom on group, combined ...
2
votes
1answer
44 views

Effective way to plot values with a vast difference between them

Here's a nice simple bar graph. It's effective when the plotted values are in the same kind of ballpark, but when there's an outlier, it can put things out of wack. For instance, I want to plot some ...
0
votes
0answers
58 views

Commands vs keys/values for setting up a document: what an own document class should provide?

This question somehow extends the question "Package option vs setup command". I'm currently writing a class dedicated to students reports for both academic projects and internships. This class ...
1
vote
0answers
76 views

Package autonum breaks all references when used with thm-restate

I have the following LaTeX file \documentclass{article} \usepackage{thm-restate, autonum} \newtheorem{lem}{lemma} \begin{document} \begin{restatable}[Embedding lemma]{lem}{embedding} \label{lem:...
2
votes
1answer
37 views

tex4ebook (or tex4ht) doesn't treat newcommand and sub/supscript well in math mode

I found that tex4ebook (or tex4ht) doesn't treat well with subscripts or superscripts in \newcommand. For example, \documentclass{amsart} \newcommand\dotimes{{\otimes}^{\mathbb L}} \newcommand\...
8
votes
2answers
581 views

Better way to make this picture of sequence with arrows

I created this picture with very basic TikZ components and the code looks a bit messy, is there a more elegant way to do this? And secondly, is there a way to put dots at the stubs of the arrows in ...
3
votes
4answers
220 views

A universal method for left-hand alignment of a sequence of equalities

With this code \documentclass[a4paper,12pt]{article} \usepackage{mathtools, mathrsfs} %% Code for '\widebar' macro is courtesy of %% https://tex.stackexchange.com/a/60253 \makeatletter \let\save@...

1
2 3 4 5
14