Tuesday, March 8, 2011

My Latex Custom Definitions

This set goes either in the preamble of my latex documents or in the class file. It is convenient to switch between publication formats by just changing the definition here rather than throughout the document.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% REFERENCING Commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EQUATIONS
\renewcommand{\eqref}[1]{Eq.~(\ref{#1})} % Eq. (1)
\newcommand{\seqref}[1]{Equation (\ref{#1})} % Equation at the start of a sentence
% MULTIPLE EQUATIONS: CAPTURES THE BEGINNING & ENDING EQN NUMBERS
\newcommand{\eqsref}[2]{Eqs.~(\ref{#1}--\ref{#2})}% Eqs. (1-3) in text: use \eqsref{eq1}{eq3}
\newcommand{\seqsref}[2]{Equations (\ref{#1}--\ref{#2})} % Equations (1-3) at the start of a sentence
% PARTS OF EQUATIONS WITH LABELS / Eq. (1a)
\newcommand{\eqrefa}[2]{Eq.~(\ref{#1}{#2})}% Eq. (1a) : with a suffix in text
\newcommand{\eqsrefa}[2]{Equation (\ref{#1}{#2})}% Equation (1a): with suffix at sentence beginning
% FIGURES
\newcommand{\figref}[1]{Fig.~\ref{#1}} % Fig. 1
\newcommand{\sfigref}[1]{Figure \ref{#1}} % Figure 1 at the start of a sentence
% MULTIPLE FIGURES
\newcommand{\figsref}[2]{Figs.~\ref{#1}--\ref{#2}} % Figs. 1-3 in text: use \figsref{fig1}{fig3}
\newcommand{\sfigsref}[2]{Figures \ref{#1}--\ref{#2}} % Figures 1-3 at the start of a sentence
% PARTS OF FIGURES WITH LABELS
\newcommand{\figrefa}[2]{Fig.~\ref{#1}{#2}} % Fig. 1a -may use \ref{#1}{\it{#2}}} for a different style
\newcommand{\sfigrefa}[2]{Figure \ref{#1}{#2}} % Figures 1a at the start of a sentence
% TABLES
\newcommand{\tblref}[1]{Table \ref{#1}} % TABLES
\newcommand{\stblref}[1]{Table \ref{#1}}
\newcommand{\tblsref}[2]{Tables \ref{#1}--\ref{#2}} % TABLES in text: use \tblsref{tbl1}{tbl3}
% SECTIONS
\newcommand{\secref}[1]{Sec.~\ref{#1}}
\newcommand{\secsref}[2]{Secs.~\ref{#1}--\ref{#2}}
\newcommand{\ssecref}[1]{Section \ref{#1}}
\newcommand{\ssecsref}[2]{Sections \ref{#1}--\ref{#2}}
\newcommand{\algref}[1]{Alg.~\ref{#1}}
\newcommand{\algrefs}[2]{Algs.~\ref{#1}--\ref{#2}}
\newcommand{\salgref}[1]{Algorithm \ref{#1}}
\newcommand{\salgsref}[2]{Algorithms \ref{#1}--\ref{#2}}
\newcommand{\appref}[1]{App.~\ref{#1}}
\newcommand{\appsref}[2]{Apps.~\ref{#1}--\ref{#2}}
\newcommand{\sappref}[1]{Appendix \ref{#1}}
\newcommand{\sappsref}[2]{Appendices \ref{#1}--\ref{#2}}
\newcommand{\chapref}[1]{Ch.~\ref{#1}}
\newcommand{\chapssref}[2]{Chs.~\ref{#1}--\ref{#2}}
\newcommand{\schapref}[1]{Chapter \ref{#1}}
\newcommand{\schapsref}[2]{Chapters \ref{#1}--\ref{#2}}
%----------------------------------------------------------------------------------------------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% VECTORS
\newcommand{\bvec}{\ensuremath{\boldsymbol}} % Change \boldsymbol to \mathbf for non-italic vectors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\ubf}{\ensuremath{\bvec{u}}}
\newcommand{\ubfbar}{\ensuremath{\bar{\ubf}}}
\newcommand{\ubftilde}{\ensuremath{\tilde{\ubf}}}
\newcommand\nbf{\ensuremath{\bvec{n}}}
\newcommand \e {{{\bvec{e}}}}
\newcommand \ex {{\e}_x}
\newcommand \ey {{\e}_y}
\newcommand \ez {{\e}_z}
\newcommand \er {{\e}_r}
\newcommand \et {{\e}_{\theta}}
\newcommand{\Omegabf}{\ensuremath{\bvec{\it{\Omega}}}}
\newcommand{\omegabf}{\ensuremath{\bvec{\it{\omega}}}}
% VARIABLES
\newcommand \rhobar{\ensuremath{\bar{\rho}}}
\newcommand \rhotilde{\ensuremath{\tilde{\rho}}}
\newcommand \thalf{\ensuremath{{\textstyle\frac{1}{2}}}}
\newcommand \etal{\mbox{\textit{et al.}}}
\newcommand \etc{etc.\ }
\newcommand \eg{e.g.\ }
\newcommand \V {\ensuremath{\mathcal{V}}} % for control volume
\newcommand \Vcal {\ensuremath{\mathcal{V}}} % for control volume
\newcommand \G {\ensuremath{\mathcal{G}}} % for script function G
\newcommand \F {\ensuremath{\mathcal{F}}} % for script function F
\newcommand \Gcal {\ensuremath{\mathcal{G}}} % for script function G
\newcommand \Fcal {\ensuremath{\mathcal{F}}} % for script function F
\newcommand \Sf {\ensuremath{\mathcal{S}}} % for control surface
\newcommand \Scal {\ensuremath{\mathcal{S}}} % for control surface
% INTEGRATION
\newcommand \dSf {\ensuremath{\, {\rm d} \mathcal{S}}} % surface
\newcommand \dV {\ensuremath{\, {\rm d} \mathcal{V}}}
\newcommand \dr {\ensuremath{\,{\rm d}r}}
\newcommand \dtheta {\ensuremath{\,{\rm d}\theta}}
\newcommand \dphi {\ensuremath{\,{\rm d}\phi}}
\newcommand \dx {\ensuremath{\,{\rm d}x}}
\newcommand \dy {\ensuremath{\,{\rm d}y}}
\newcommand \dz {\ensuremath{\,{\rm d}z}}
\newcommand \dt {\ensuremath{\,{\rm d}t}}
\newcommand \dd {\ensuremath{\,{\rm d}}}

No comments: