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

AI Thread Summary
The discussion focuses on optimizing LaTeX usage for homework and report writing by utilizing macros in the preamble to streamline the typesetting process. Participants share various macro definitions that simplify the input of complex symbols and equations, such as shortcuts for parentheses and common mathematical notations. Suggestions include creating a cheat sheet for frequently used LaTeX commands and examining source codes from arXiv for inspiration on handling long equations. Users emphasize the importance of defining personal shortcuts to enhance efficiency, with examples of commands for mathematical operators and symbols. Overall, the conversation highlights practical strategies to reduce the time spent on LaTeX formatting while maintaining a professional appearance in documents.
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 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
3
Views
3K
Replies
4
Views
2K
Replies
3
Views
2K
Replies
11
Views
4K
Replies
4
Views
4K
Replies
3
Views
11K
Replies
3
Views
13K
Back
Top