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
2
votes
0answers
33 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
54 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 ...
3
votes
1answer
50 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
52 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
36 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
49 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
22 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
344 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
185 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?
7
votes
2answers
243 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 ...
4
votes
1answer
74 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
37 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
51 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
36 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
25 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\...
0
votes
0answers
38 views

What are some differences between the exam class and the examdesign class?

The exam class and examdesign class are both intended for exam designing typesetting. What are some unique features of theirs? What are some advantages and disadvantages of one over the other?
8
votes
2answers
544 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
203 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@...
2
votes
2answers
67 views

Derivatives specifying dependency of a function on its arguments

I want to write the partial derivative of a function, while making the parameters of that function explicit, like so: \dfrac{\partial f(x, y)}{\partial x} But this leads to an elongated horizontal ...
3
votes
1answer
146 views

Character choice for csquotes active quotes

We all know csquotes and the multiple facilities it provides for displaying quotations and related content. One feature I'm particularly fond of are the active quotes, using \MakeAutoQuote. That's ...
2
votes
3answers
89 views

Declaring option a4paper in \documentclass produces different margins than declaring it in \geometry

I have seen a similar question at a4paper, where should I declare it? In document class or geometry? and the selected answer there implies that there is no difference in whether we use \documentclass[...
3
votes
0answers
51 views

Pysub the entire document

In pythontex the pysub environment provides a nice syntax to refer to python variables (for example !{a}) inside your latex code. Suppose you have only one pythontex session in your document. Is ...
14
votes
0answers
539 views

Alternatives to the physics package

The physics package is useful A lot of my LaTeX documents make heavy use of the physics package. Aside from it overloading several standard commands (e.g. \sin, \abs, etc.), it also makes a few ...
1
vote
0answers
214 views

List of Best CTAN packages [duplicate]

Some of the packages of CTAN are really good but not discovered by many. I recently encountered one of the good ones, namely latexindent, and I thought that would be great if everyone introduces the ...
2
votes
0answers
50 views

Is it common practice to insert images at the top of a page? [closed]

This is not a question about how to insert images at the top, but rather asking whether or not this is common practice. The template I've received from my university automatically inserts figures at ...
5
votes
2answers
182 views

What would you include in a short “What is LaTeX and why should I use it?” presentation

I will give a short coffee lecture (15 minutes) on LaTeX at our institution. Something like: "What is LaTeX and why should I use it? Getting started and avoiding pitfalls." The presentation will ...
2
votes
1answer
82 views

tex4ht (or tex4ebook) is not compatible with ^\mathbb, _\mathfrak, etc

To export many mathematical articles and surveys to Kindle from the LaTeX source code, I am trying to use tex4ebook. It seems to me that I still need to hack many LaTeX codes to finish the compilation,...
1
vote
1answer
66 views

Inspiration of how to quote an e-mail correspondence

I am looking for a good way to typeset a e-mail correspondence (maybe including multiple levels of quotations). In an e-mail program this may look like this: this or this one I am not looking of ...
4
votes
3answers
118 views

Alignment of terms within align environment

The solutions below require up-to-date versions of LaTeX When I tried to run the solutions below on my own machine I was not able to reproduce their results, but still got unwanted offsets. ...
1
vote
2answers
173 views

How should I split/break up large LyX files?

I have a large LyX file that sometimes gets slow (the output PDF is over 1600 pages with figures, etc.). (Indeed, with LyX 2.3.x it is somehow unbearable and buggy for me, and so I have stuck with 2.2....
2
votes
0answers
74 views

What are the most commonly used colors for References and Cites?

Here's a little excerpt from the thesis I'm working on: The LaTeX template was provided by my university, and it defaulted to superscript brackets with blue numbers for cites and red for anything ...
3
votes
0answers
106 views

Software Architecture and xtemplate

When writing a package, there may be the situation that several things need to interact to make a complete product. When using xtemplate, I can define each part as an object. This means that the ...
4
votes
1answer
78 views

Making Environments Using xtemplate

The examples for xtemplate show how to make document commands, but I haven’t seen anything involving environments. If I were to define an environment using xtemplate, what would the best approach be? ...
2
votes
2answers
140 views

When writing a paper, is it more advisable to write $1/(2n)$ or $\frac{1}{2n}$ in line with text?

I have lots of doubts (questions) on how to best present my findings. I'm not sure if most writers use the horizontal $1/(2n)$ to keep the line narrow, or the vertical $\frac{1}{2n}$, which widens ...
4
votes
1answer
94 views

If a package is loaded automatically, should I still load it manually if I explicitly need its features?

Many packages are loaded as prerequisites by other packages that internally use some of this package’s features. If I need to use a specific package, and this packages is already loaded by another ...
3
votes
2answers
151 views

$x_1, \dotsc, x_n$ vs. $x_1$, $\dots$, $x_n$

For example, if I want to say something like Let x_1, ..., x_n be real numbers. should I use Let $x_1, \dotsc, x_n$ be real numbers. or Let $x_1$, $\dots$, $x_n$ be real numbers. Note that if ...
2
votes
0answers
231 views

Best Practices Compilation in Math Mode [closed]

I consider myself a relatively experienced latex user. I am looking for best practices for math mode in LaTeX. Looking around the exchange I couldn't find a post that captures this question broadly. ...
0
votes
0answers
44 views

best practice for consistent text snippets [duplicate]

In a book document I must assure that the same text (a few lines) appears at several places, despite editing. Using the text editor to include the same text snippet does not guarantee consistency in ...
9
votes
1answer
143 views

Package option vs setup command

Traditionally, LaTeX packages will use package options (I mean the options in \usepackage[...]{package}) for setup. However, I have noticed in some modern packages, e.g. siunitx, unicode-math, ctex, ...
2
votes
1answer
292 views

LaTeX convention how to indent source? [closed]

I am new at LaTeX and I am asking myself at the moment if there is a convention how to indent the source code. For example: \begin{itemize} \item erstes Stichwort \item zweites Stichwort \end{...
1
vote
0answers
52 views

scalebox or new font switch to create specific font size?

I want to set a small portion of text in a font size not covered by the standard font switches and found two ways to do so: Define a new font switch: \newcommand\newfs{\fontsize{48}{60}\selectfont}, ...
0
votes
1answer
172 views

Correct hyphen/style to use in bullet lists

I have several lists in my thesis document that look like this: \begin{itemize}[nosep] \item 0x0000 - free cluster \item 0xFFFF - last cluster of the file (still including file data) \...
2
votes
1answer
274 views

What is the difference between url and xurl?

Like I understood adds xurl better line breaking to url. Right, or is one of it obsolete? When not, what should I use in which case? Thank you for your help and effort in advance!
3
votes
1answer
162 views

What is the difference between inputenc and inputenx?

Like I understood covers inputenx more cases as inputenc. Right, or is one of it obsolete? When not, what should I use in which case? I use pdfTeX version 3.14159265-2.6-1.40.19 (and MiKTeX). Thank ...
0
votes
1answer
95 views

My solution to small brackets and missing delimiter (. inserted) error

Problem: \begin{equation} \begin{split} S_{2(n+1)}^{(1)}=\frac{2}{\Gamma(n+1)}\int_{0}^{G}dxx^{2n+1}[-1+\\ +n_{1}(\frac{\pi}{\alpha})^{3/2}\sideset{}{'}\sum_{l}e^{-k_{l}^{2}a^{2}/...
0
votes
0answers
68 views

When (and why) to use manual kerning for mathematical content?

I recently asked here, a question about the choice of OpenType Unicode fonts for my PhD thesis. After considering the comments and answers to the question, I decided to use Libertinus for both text ...
5
votes
1answer
142 views

Should there be paragraph break between a leading text and itemized list?

What is the right convention for rendering itemized-lists? Is it like this without any paragraph break between the previous line and the list? \documentclass{article} \begin{document} There are 10 ...
9
votes
3answers
194 views

Any way to bundle some variables in an OOP-like object in LaTeX?

I would very much like to have one object encapsulate a bunch of data, and then pass that object to a function. For example, a figure might have an URL to a file, a caption, and a width. In Python, ...
5
votes
4answers
192 views

Unwanted spaces in user defined structures and the uses of % [duplicate]

This question arise from my recent activity on user defined commands of various kind. In the answer to a recently posed question, @egreg pointed out to me the importance of not forgetting a % after ...
5
votes
1answer
150 views

Manage full and short versions of a paper

Say you have written an article of 25 pages. It is pretty common that you submit a short version (12 pages) of your article to a conference and have the full version uploaded somewhere or attached as ...