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
54 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
180 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
27 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
70 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
38 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
64 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
40 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
50 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
66 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
34 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
60 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 ...
6
votes
1answer
96 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, \...
2
votes
1answer
109 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
1answer
114 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
34 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
47 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
28 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
171 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
60 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
43 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
84 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
81 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
79 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
98 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
384 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
226 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
307 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
139 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
54 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
71 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
34 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
572 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
216 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
125 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
273 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 ...
4
votes
3answers
170 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
80 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 ...
27
votes
0answers
2k 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
577 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
52 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
213 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
102 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
88 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
180 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
333 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
84 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
119 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 ...

1
2 3 4 5
14