Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am very new to being able to use LaTeX to type up mathematical papers, and I just got my "system" set up. Currently I have installed TexWorks, and MikTex, and I have put together a 'hello world' article which seems to run well.

I have also used the syntax "\usepackage{amsmath}" and "\usepackage{amssymb}" in the beginning of my .tex file to write math symbols, only because some online tutorial said so.

My question is, firstly, are those the only packages I need to use for writing math, and secondly, I remember reading about some shortcuts(?) that can be used for writing math symbols, and/or user defined shortcuts that can be 'set' in the beginning so as to reduce the amount of LaTeX code needed to write mathematical symbols. However, I do not know if this is true, and if it is, how to go about 'installing' such a thing.

Does such a thing exist? Am I able to make my own shortcuts?


share|improve this question

2 Answers 2

up vote 11 down vote accepted

You surely can define your shortcuts; indeed you should.

Let's make some examples. Suppose your document is full of Fourier transforms, for which you need a fancy F. Instead of writing every time


it's surely better to define a new command, say


(choose any name you like), so that you can type


and get the same result as before, with a big bonus! If you change your mind about the notation, you can simply modify the definition.

Another example. The "gradient" operator is not predefined; so you might want to have a command for it:


A different one; my preferred notation for vectors is, say, \mathbf{v}. However, since conventions are different, I never type vectors in that way, but prefer to have


for the same reason as before; I might change my mind and want to modify the appearance, say for using bold italic; this would be accomplished just by saying


and changing the above into


How do you organize this? Here's an example:

\usepackage[utf8]{inputenc} % input encoding UTF-8

% Useful packages

% add all the packages you need

% Personal definitions

\newcommand{\FT}{\mathcal{F}}      % Fourier transform operator
\DeclareMathOperator{\grad}{grad}  % gradient
\newcommand{\vect}[1]{\mathbf{#1}} % vectors and matrices




Add definitions while you find that they are useful for distinguishing logical units of your document.

share|improve this answer

There's a lot of different packages, but there's no need to include them all: use only these which you need.

For example, package wrapfig allows you to add floating tables and images. You may need multicol if you'll deicide to switch between different amount of columns in your document. Use cite to make cites to bibliography more pretty. Use longtable if you wish to put multipage tables into your document. amsfonts consists some symbols you may need. wasysym consists a lot of other symbols usefull in some cases. Package array allows you to put into tables such instruction like m{}, b{}, >{}, <{}, !{} etc.

And here some things from my style file that maybe will help you:

\newcommand{\Ang}{\mbox{\rm\AA}}                % Angstom
\newcommand{\arr}{\ensuremath{\,\rightarrow\,}} % right arrow
\newcommand{\Arr}{\ensuremath{\,\Rightarrow\,}} % wide arrow
\newcommand{\aver}[1]{{<\!\!#1\!\!>}}           % average
\newcommand{\B}[1]{\ensuremath{\mathbf{#1}}}    % bold for matrix & so on
\newcommand{\bra}[1]{\ensuremath{\langle #1|}}  % bra-vector
\newcommand{\bracket}[1]{\ensuremath{\langle #1|#1\rangle}}     % square of state vector
\newcommand{\cket}[1]{\ensuremath{#1\rangle}}   % cet-vector when multiplying to bra-
\newcommand{\const}{\ensuremath{\mathfrak{const}}} % constant
\renewcommand{\C}{\ensuremath{\mathfrak{C}}}    % another constant
\newcommand{\D}{\ensuremath{\mathfrak{D}}}      % 
\newcommand{\ddotvec}[1]{%\ddot{\vec{#1}}}      % second dv/dt
\newcommand{\degr}{\ensuremath{^\circ}}         % degree
\newcommand{\diam}{\ensuremath{\varnothing\,}}  % diameter
\newcommand{\diver}{\mathop{\mathrm{div}}\nolimits} % divergence
\newcommand{\dotvec}[1]{%                       % dv/dt
\newcommand{\dpartder}[2]{\dfrac{\partial^2 #1}{\partial #2^2}} % 2nd partial derivative
\newcommand{\e}{\mathop{\mathrm e}\nolimits}    % exp
\newcommand{\E}{\mathcal{E}}                    % electromoving force
\renewcommand{\epsilon}{\varepsilon}            % epsilon by russian tradition
\newcommand{\frc}[2]{\raisebox{2pt}{$#1$}\big/\raisebox{-3pt}{$#2$}}    % fraction
\newcommand{\F}{\ensuremath{\mathop{\mathfrak F}}\nolimits}     % pretty F
\newcommand{\FT}[1]{\mathcal{F}(#1)}            % fourier
\renewcommand{\H}{\ensuremath{\mathfrak{H}}}    % 
\newcommand{\IFT}[1]{\mathcal{F}^{-1}(#1)}      % reverse fourier
\renewcommand{\ge}{\geqslant}                   % >=
\newcommand{\grad}{\mathop{\mathrm{grad}}\nolimits} % gradient
\newcommand{\I}{\ensuremath{\mathfrak{I}}}      % short for integral
\newcommand{\ind}[1]{_{\text{\scriptsize #1}}}  % down index
\newcommand{\indfrac}[2]{\raisebox{2pt}{$\frac{\mbox{\small $#1$}}{\mbox{\small $#2$}}$}} 
\newcommand{\ILT}[1]{\mathop{\mathfrak{L}}\nolimits^{-1}(#1)} % reverse laplas
\newcommand{\Infint}{\int\limits_{-\infty}^\infty} % integral by R
\newcommand{\Int}{\int\limits}          % Big integral
\newcommand{\IInt}{\mathop{{\int\!\!\!\int}}\limits}    % Big double integral
\renewcommand{\kappa}{\varkappa}                % kappa in russian traditions
\newcommand{\ket}[1]{\ensuremath{|#1\rangle}}   % cet-vector
\renewcommand{\le}{\leqslant}                   % <=
\newcommand{\ltextarrow}[1]{\ensuremath{\stackrel{#1}\leftarrow}} % left arrow with text above
\newcommand{\lvec}{\overrightarrow}             % long vector
\newcommand{\LT}[1]{\mathop{\mathfrak{L}}\nolimits(#1)} % laplas
\newcommand{\M}{\ensuremath{\mathop{\mathfrak M}\nolimits}} % stellar mass
\newcommand{\mean}[1]{\overline{#1}}            % mean
\newcommand{\med}[1]{\mathop{\mathrm{med} #1}\nolimits} % median
\newcommand{\Oint}{\oint\limits}                % Big circular integral
\renewcommand{\P}{\ensuremath{\mathfrak{P}}}    % 
\newcommand{\partder}[2]{\dfrac{\partial #1}{\partial #2}} % partial der.
\renewcommand{\phi}{\varphi}                    % phi in russuan
\newcommand{\R}{\ensuremath{\mathbb{R}}} % rat. numbers
\newcommand{\rev}[1]{\frac{1}{#1}}              % reverse
\newcommand{\rot}{\mathop{\mathrm{rot}}\nolimits} % curve (rotor in russian)
\newcommand{\rtextarrow}[1]{\ensuremath{\stackrel{#1}\rightarrow}} % rightarrow with text
\newcommand{\Sum}{\sum\limits}  % sum
\newcommand{\sinc}{\mathop{\mathrm{sinc}}\nolimits} % integral sinus
\newcommand{\Tr}{\mathop{\mathrm{Tr}}\nolimits} % matrix trace
\newcommand{\veci}{{\vec\imath}}                % i-ort
\newcommand{\vecj}{{\vec\jmath}}                % j-ort
\newcommand{\veck}{{\vec{k}}}                   % k-ort
\newcommand{\when}[2]{\settowidth{\myflt}{\scriptsize $#2$}% vert. line with limits
\newcommand{\ZT}[1]{\mathop{\mathcal{Z}}\nolimits(#1)} % Z-transform
\newcommand{\IZT}[1]{\mathop{\mathcal{Z}}\nolimits^{-1}(#1)} % rev. Z
share|improve this answer
This piece of code contains lots of things that are very bad. First of all, all \ensuremath, \aver should be made using \langle...\rangle etc. Generally look into amsmath and mathtools documentation, especially on macros \DeclareMathOperator, \DeclarePairedDelimiter and \DeclarePairedDelimiterX. – yo' Jan 28 '13 at 17:55
@tohecz, For example? – Eddy_Em Jan 28 '13 at 17:56
Thanks Eddy, but I have many questions - 1) first of all, 'where' do I copy/paste all of this? I am very new to TexWorks. Do I just put it in the top of my .tex page? 2) How do you 'add' packages? – TyranaSaur Jan 28 '13 at 18:18
@Eddy_Em Your definition of \F is plainly wrong. Just try writing $\F\mathfrak{F}$ to see why. I fully agree with tohecz that all \ensuremath are wrong. amsmath makes available \xrightarrow that does much better than your \ltextarrow; \ind may be simply _\text{#1}; \iint is better than your \IInt. I could continue. – egreg Jan 28 '13 at 18:18
@egreg, some of my definitions were made so because I didn't like standard behaviour. Also some definitions mirrors russian math traditions. @Mohammad, read carefully comments of egreg & tohecz. About including: usually such things gathered in user-style: simple .sty file which then included into documents by \usepackage. – Eddy_Em Jan 28 '13 at 18:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.