What are the macros you guys use to speed up LaTeX-ing?

Click For Summary
SUMMARY

This discussion focuses on optimizing LaTeX document preparation through the use of macros in the preamble. Users share specific macros such as \def\cA{{\cal A}} and \newcommand{\dd}{\mathrm{d}} to streamline the typesetting of complex equations and symbols. Participants emphasize the importance of creating shortcuts for frequently used commands, which significantly reduces typing time. Additionally, referencing sources on arXiv for complex articles is recommended as a valuable resource for discovering new macros.

PREREQUISITES
  • Familiarity with LaTeX syntax and document structure
  • Understanding of mathematical notation in LaTeX
  • Basic knowledge of creating and using macros in LaTeX
  • Experience with LaTeX packages for advanced symbols and formatting
NEXT STEPS
  • Explore the use of the forloop package for creating dynamic macros
  • Learn about defining custom commands with \newcommand and \def
  • Investigate the amsmath package for enhanced mathematical typesetting
  • Review complex LaTeX documents on arXiv to identify effective macros and techniques
USEFUL FOR

Students, researchers, and academics who frequently use LaTeX for writing reports and papers, particularly those dealing with complex mathematical content.

tesselate
Messages
7
Reaction score
0
Hello everyone!
I was wondering if you guys could suggest some macro-s that you use in your LaTeX preamble, to speed up typing up your homeworks/reports.
I think typesetting any report looks very professional, so I don't want to stop LaTeX-ing them. However, it does take a huge chunk of my day, to just type up long equations. I was wondering if you had any tips to share to speed up this process?
 
Physics news on Phys.org
You could make a one page cheat sheet of common latex symbols and phrases and then have both documents open when writing your report using copy and paste to compose your report.

This saves you a little time in looking up stuff or typing stuff.
 
tesselate said:
Hello everyone!
I was wondering if you guys could suggest some macro-s that you use in your LaTeX preamble, to speed up typing up your homeworks/reports.
I think typesetting any report looks very professional, so I don't want to stop LaTeX-ing them. However, it does take a huge chunk of my day, to just type up long equations. I was wondering if you had any tips to share to speed up this process?

You can check the source of some complex articles on arxiv to see how they go about long equations.

I sometimes define shortcuts like \lp to denote \left(, same for brackets and curly braces.
When I needed to write a lot of wedge products ##\wedge## I defined a shortcut \w.

Those are small things that can speed up your writing especially the macros for parentheses.
 
I use all of these:

Code:
\def\cA{{\cal A}}
\def\cB{{\cal B}}
\def\cC{{\cal C}}
% etc...

\def\CC{\mathbb{C}}
\def\RR{\mathbb{R}}
\def\PP{\mathbb{P}}
\def\ZZ{\mathbb{Z}}
\def\QQ{\mathbb{Q}}
\def\HH{\mathbb{H}}
\def\SS{\mathbb{S}}

\newcommand{\dd}{\mathrm{d}}                   % exterior d
\DeclareMathOperator*{\hodge}{\star}               % hodge star
\newcommand{\vol}{\mathrm{vol}}               % volume form
\DeclareMathOperator{\Lie}{\mathcal{L}}      % Lie derivative
\DeclareMathOperator*{\diag}{\mathrm{diag}}       % diagonal matrix
\DeclareMathOperator{\Span}{\mathrm{span}}       % span
\DeclareMathOperator{\ad}{\mathrm{ad}}           % Lie algebra adjoint
\DeclareMathOperator{\Ad}{\mathrm{Ad}}           % group adjoint
\DeclareMathOperator{\Ric}{\mathrm{Ric}}           % Ricci tensor
\DeclareMathOperator{\Rf}{\mathfrak{R}}           % Ricci form
\DeclareMathOperator{\into}{\raisebox{0.2ex}{\reflectbox{\rotatebox[origin=c]{180}{$\neg$}}}}
                                           % interior product
\DeclareMathOperator{\ins}{\iota}                   % insertion operator
\newcommand{\norm}[1]{{\lVert {#1} \rVert}}           % norm
\newcommand{\abs}[1]{{\lvert {#1} \rvert}}           % absolute value
\newcommand{\inprod}[2]{\langle {#1}, {#2} \rangle}
\newcommand{\binprod}[2]{\big \langle {#1}, \, {#2} \big \rangle}
\DeclareMathOperator{\codim}{codim}           % codimension
\DeclareMathOperator{\sign}{sign}               % signum
\DeclareMathOperator{\id}{\mathrm{id}}   % identity
\DeclareMathOperator{\lcm}{\mathrm{lcm}}       % least common multiple

% better overlines
\newcommand*\widebar[1]{%
   \mkern2.2mu%
   \overline{%
       \mkern-2.2mu%
       %\rule{0pt}{6pt}%
       {#1}%
       \mkern-1.8mu%
   }%
   \mkern1.8mu%
}

\usepackage{forloop}
\newcounter{ct}

% (-+++...) Minkowski signature
\newcommand{\mink}[1]{(\mathord{-} \forloop[-1]{ct}{#1}{\value{ct} > 1}{\, \mathord{+}})}

% (+++...) Euclidean signature
\newcommand{\eucl}[1]{(%
   \ifthenelse{#1 > 0}{%
       \mathord{+} \forloop[-1]{ct}{#1}{\value{ct} > 1}{\, \mathord{+}}%
   }{}%
)}

% generic (---...+++...) signature
\newcommand{\sig}[2]{(%
   \ifthenelse{#2 > 0}{%
       \mathord{-}  \forloop[-1]{ct}{#2}{\value{ct} > 1}{\, \mathord{-}}%
       \ifthenelse{#1 > 0}{\,}{}%
   }{}%
   \ifthenelse{#1 > 0}{%
       \mathord{+} \forloop[-1]{ct}{#1}{\value{ct} > 1}{\, \mathord{+}}%
   }{}%
)}

You're on your own for figuring out what packages might be required to access various symbols.
 
  • Like
Likes   Reactions: JorisL
Thank you for your suggestions! This will definitely cut down on time. I have implemented some of the commands from Ben Niehoff's preamble, and created some on my own. Also, looking at arxiv sources is my go-to place now if I come across something new.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 23 ·
Replies
23
Views
5K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
11K
  • · Replies 3 ·
Replies
3
Views
13K