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

In summary, the LaTeX preamble for speed typing up reports can include shortcuts for common symbols and equations, and using the math operators codimension, id, and lcm.
  • #1
tesselate
7
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
  • #2
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.
 
  • #3
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.
 
  • #4
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
  • #5
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.
 

1. What are macros in LaTeX?

Macros in LaTeX are commands that allow you to define your own shortcuts for commonly used sequences of code. They can be used to save time and make your document more efficient.

2. How do macros speed up LaTeX-ing?

Macros can speed up LaTeX-ing by allowing you to type shorter commands instead of longer ones. This can save time and reduce the chances of making typos.

3. Can I create my own macros?

Yes, you can create your own macros in LaTeX. You can define them using the \newcommand or \renewcommand commands, and they can be customized to your specific needs.

4. Are there any pre-defined macros in LaTeX?

Yes, there are pre-defined macros in LaTeX that come with the standard distribution. These include commonly used symbols, formatting commands, and more. You can also find many useful macros created by other users online.

5. How can I learn more about using macros in LaTeX?

To learn more about using macros in LaTeX, you can refer to the official documentation or online tutorials and resources. You can also experiment and practice creating your own macros to become more familiar with their functionality.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
223
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
23
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Chemistry
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
10K
Back
Top