Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Sep 10, 2016 #1
    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?
  2. jcsd
  3. Sep 10, 2016 #2


    Staff: Mentor

    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.
  4. Sep 11, 2016 #3
    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.
  5. Sep 12, 2016 #4

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    I use all of these:

    Code (Text):

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


    \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
                                               % 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


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

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

    % generic (---...+++...) signature
       \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.
  6. Sep 24, 2016 #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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: What are the macros you guys use to speed up LaTeX-ing?
  1. Use latex (Replies: 10)