A custom command file

15.3 A custom command file

User-defined commands, of course, are a matter of individual need and taste. I have collected some commands for writing papers in lattice theory in the newlattice.sty file, which you can find in the samples folder (see page 4). I hope that this model helps you to develop a command file of your own. Please remember that everything we discuss in this section is a reflection of my work habits. Many experts disagree with one or another aspect of the way I define the commands, so take whatever suits your needs. And keep in mind the dangers of customization discussed in Section 15.7.

Tip Some journals do not permit the submission of a separate custom command file. For such journals, just copy the needed user-defined commands into the preamble of the article.

This file is named newlattice.sty. It can be loaded with \usepackage. This has a number of advantages.

Your command names should be mnemonic. If you cannot easily remember a command’s name, rename it. The implication here is that your command file should not be very large unless you have an unusual ability to recall abbreviations.

Here are the first few lines of the newlattice.sty command file: % newlattice.sty

% New command file for lattice papers \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{newlattice}[2006/03/15 v1.2

New commands for lattices] \RequirePackage{amsmath} \RequirePackage{amssymb} \RequirePackage{latexsym} \RequirePackage[mathscr]{eucal} \RequirePackage{verbatim} \RequirePackage{enumerate} \RequirePackage{xspace}

The line \NeedsTeXFormat{LaTeX2e}[2005/12/01] gives an error message if a document loading the newlattice package is typeset with

L A TEX 2.09 or with an older version of the standard L A TEX. The next line provides information that is written in your log file. The next seven lines declare what packages are required. If some of these pack- ages have not yet been loaded, then the missing packages are loaded. A package loaded

15.3 A custom command file 387

with \RequirePackage is not read in again. Being able to specify the packages we need is one of the great advantages of command files. When I write a document, the packages are there if I need them. You may want some justification for the inclusion of two of these packages in this list. The verbatim package is on the list so that I can use the comment environment to comment out large blocks of text (see Section 5.5.1), which is useful for finding errors and typesetting only parts of a longer document—but do not forget to remove your comments before submission. The enumerate package is on the list because the enumeratei and enumeratea environments, defined in newlattice.sty, require it.

If you start your article with \documentclass{amsart}

\usepackage{newlattice} then the \listfiles command (see Section D.3.4) produces the following list when

your document is typeset: *File List*

amsart.cls 2004/08/06 v2.20 amsmath.sty

2000/07/18 v2.13 AMS math features

amstext.sty 2000/06/29 v2.01 amsgen.sty

1999/11/30 v2.0 amsbsy.sty

1999/11/29 v1.2d amsopn.sty

1999/12/14 v2.01 operator names umsa.fd

2002/01/19 v2.2g AMS font definitions

amsfonts.sty 2001/10/25 v2.2f newlattice.sty

2006/03/15 New commands for lattices v1.2 amssymb.sty

2002/01/22 v2.2d enumerate.sty

1999/03/05 v3.00 enumerate extensions (DPC) graphicx.sty

1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) keyval.sty

1999/03/16 v1.13 key=value

parser (DPC)

trig.sty

1999/03/16 v1.09 sin cos tan (DPC)

graphics.cfg 2005/02/03 v1.3 graphics configuration

of teTeX/TeXLive

pdftex.def

2002/06/19 v0.03k graphics/color

for pdftex umsa.fd

2002/01/19 v2.2g AMS font definitions

umsb.fd

2002/01/19 v2.2g AMS font definitions

ueuf.fd

2002/01/19 v2.2g AMS font definitions

388 Chapter 15 Customizing L A TEX

Now we continue with newlattice.sty. After the introductory section dealing with L A TEX and the packages, we define some commands for writing about lattices and sets:

% Lattice operations \newcommand{\jj}{\vee}% join \newcommand{\mm}{\wedge}% meet \newcommand{\JJ}{\bigvee}% big join \newcommand{\MM}{\bigwedge}% big meet \newcommand{\JJm}[2]{\JJ(\,#1\mid#2\,)}% big join with a middle \newcommand{\MMm}[2]{\MM(\,#1\mid#2\,)}% big meet with a middle % Set operations \newcommand{\uu}{\cup}% union \newcommand{\ii}{\cap}% intersection \newcommand{\UU}{\bigcup}% big union \newcommand{\II}{\bigcap}% big intersection \newcommand{\UUm}[2]{\UU(\,#1\mid#2\,)}% big union with a middle \newcommand{\IIm}[2]{\II(\,#1\mid#2\,)}

% big intersection with a middle

% Sets \newcommand{\contd}{\subseteq}% contained in \newcommand{\ncontd}{\nsubseteq}% not \contd \newcommand{\scontd}{\subset}% strictly contained in \newcommand{\contg}{\supseteq}% containing with equality \newcommand{\ncontg}{\nsupseteq}% not \contg \newcommand{\nin}{\notin}% not \in \newcommand{\empset}{\varnothing}% the empty set \newcommand{\set}[1]{\{#1\}}% set \newcommand{\setm}[2]{\{\,#1\mid#2\,\}}% set with a middle \def\vect<#1>{\langle#1\rangle}% vector

So $a \jj b$ produces a ∨ b and $A \contd B$ produces A ⊆ B, and so on. The original commands are not redefined, so if a coauthor prefers $a \vee b$ to $a \jj b$, the \vee command is available.

The commands with a “middle” are exemplified by \setm: $\setm{x \in R}{x^2 \leq 2}$ typesets as

{x∈R|x 2 ≤ 2 }. Using the \set command, we can type the set {a, b} as $\set{a,b}$, which is

easier to read than $\{a,b\}$. Similarly, we type $\vect<a,b>$ for the vector

ha, bi,

15.3 A custom command file 389

so it looks like a vector. Next in newlattice.sty I map the Greek letters to easy to remember commands.

For some, I prefer to use the variants, but that is a matter of individual taste. It is also a matter of taste whether or not to change the commands for the Greek letters at all, and how far one should go in changing commonly used commands.

% Greek letters \newcommand{\Gra}{\alpha} \newcommand{\Grb}{\beta} \newcommand{\Grc}{\chi} \newcommand{\Grd}{\delta} \renewcommand{\Gre}{\varepsilon} \newcommand{\Grf}{\varphi} \renewcommand{\Grg}{\gamma} \newcommand{\Grh}{\eta} \newcommand{\Gri}{\iota} \newcommand{\Grk}{\kappa} \newcommand{\Grl}{\lambda} \newcommand{\Grm}{\mu} \newcommand{\Grn}{\nu} \newcommand{\Gro}{\omega} \newcommand{\Grp}{\pi} \newcommand{\Grq}{\theta} \newcommand{\Grr}{\varrho} \newcommand{\Grs}{\sigma} \newcommand{\Grt}{\tau} \newcommand{\Gru}{\upsilon} \newcommand{\Grv}{\vartheta} \newcommand{\Grx}{\xi} \newcommand{\Gry}{\psi} \newcommand{\Grz}{\zeta}

\newcommand{\GrG}{\Gamma} \newcommand{\GrD}{\Delta} \newcommand{\GrF}{\Phi} \newcommand{\GrL}{\Lambda} \newcommand{\GrO}{\Omega} \newcommand{\GrP}{\Pi} \newcommand{\GrQ}{\Theta} \newcommand{\GrS}{\Sigma} \newcommand{\GrU}{\Upsilon} \newcommand{\GrX}{\Xi} \newcommand{\GrY}{\Psi}

390 Chapter 15 Customizing L A TEX

I also introduce some new names for text font commands by abbreviating text to t (so that \textbf becomes \tbf) and for math font commands by abbreviating math to m (so that \mathbf becomes \mbf).

% Font commands \newcommand{\tbf}{\textbf}% text bold \newcommand{\tit}{\textit}% text italic \newcommand{\tsl}{\textsl}% text slanted \newcommand{\tsc}{\textsc}% text small cap \newcommand{\ttt}{\texttt}% text typewriter \newcommand{\trm}{\textrm}% text roman \newcommand{\tsf}{\textsf}% text sans serif \newcommand{\tup}{\textup}% text upright \newcommand{\mbf}{\mathbf}% math bold \providecommand{\mit}{\mathit}% math italic \newcommand{\msf}{\mathsf}% math sans serif \newcommand{\mrm}{\mathrm}% math roman \newcommand{\mtt}{\mathtt}% math typewriter

The math alphabets are invoked as commands with arguments: \Bold for bold, \Cal for calligraphic, \DD for blackboard bold (double), and \Frak for fraktur (German Gothic) (see Section 8.3.2). Notice that \Cal and \Euler are different because of the option mathscr of the eucal package (see Section 8.3.1).

\newcommand{\Bold}[1]{\boldsymbol{#1}} % Bold math symbol, use as \Bold{\alpha} \newcommand{\Cal}[1]{\mathcal{#1}} % Calligraphics - only caps, use as \Cal{A} \newcommand{\DD}[1]{\mathbb{#1}} % Doubled - blackboard bold - only caps, use as \DD{A} \newcommand{\Euler}[1]{\mathscr{#1}} % Euler Script - only caps, use as \Euler{A} \newcommand{\Frak}[1]{\mathfrak{#1}}% Fraktur, use as \Frak{a}

\Bold{A} typesets bold italic A, A; to get upright bold, use \mathbf{A}, which type- sets as

A. Here are some commands of importance in lattice theory: % Constructs

\DeclareMathOperator{\Id}{Id} \DeclareMathOperator{\Fil}{Fil} \DeclareMathOperator{\Con}{Con} \DeclareMathOperator{\Aut}{Aut} \DeclareMathOperator{\Sub}{Sub}

15.3 A custom command file 391

\DeclareMathOperator{\Pow}{Pow} \DeclareMathOperator{\Part}{Part} \DeclareMathOperator{\Ker}{Ker} \newcommand{\Ji}[1]{\tup{J}(#1)} %join irreducible \newcommand{\Mi}[1]{\tup{M}(#1)} %meet irreducible

% Generated by \newcommand{\con}[1]{\tup{con}(#1)} \newcommand{\sub}[1]{\tup{sub}(#1)} \newcommand{\id}[1]{\tup{id}(#1)} \newcommand{\fil}[1]{\tup{f{}il}(#1)} \newcommand{\Downg}{\downarrow\!}% down-set generated by

Here are a few more commands and environments: % Miscellaneous

\newcommand{\newl}{\newline} \newcommand{\overl}[1]{\overline{#1}} \newcommand{\underl}[1]{\underline{#1}} \providecommand{\bysame}{\makebox[3em]%

{\hrulefill}\thinspace} \newcommand{\iso}{\cong}% isomorphic \def\congr#1=#2(#3){#1\equiv#2\pod{#3}}

%congruence, use it as \congr a=b(\theta)% \newcommand{\itemref}[1]{\eqref{#1}} \newenvironment{enumeratei}{\begin{enumerate}%

[\upshape (i)]}{\end{enumerate}} %produces (i), (ii), etc. Reference with \itemref \newenvironment{enumeratea}{\begin{enumerate}% [\upshape (a)]}{\end{enumerate}} %produces (a), (b), etc. Reference with \itemref \theoremstyle{plain} \newtheorem*{namedtheorem}{\theoremname} \newcommand{\theoremname}{testing} \newenvironment{named}[1]{\renewcommand{\theoremname}{#1}

\begin{namedtheorem}} {\end{namedtheorem}} %use it as \begin{named}{Name of theorem}

%Body of theorem \end{named} \endinput For the \congr command see Section 15.1.8. The enumeratei and named environ- ments are discussed in Section 15.2.1. The enumeratea environment is similar.

392 Chapter 15 Customizing L A TEX This command file, like all command files, is terminated with the \endinput

command. In Section 18.3.2, we discuss the same rule for files that are \include-d. My newlattice.sty evolves with time. I keep a copy in the folder of every article I write. This way, even years later, with the command file much changed, I can typeset the article with no problem.

The \TextOrMath command (see Section 12.3) is very useful for command files. For instance, we can use it to define our Greek letters, such as

\newcommand{\Gra}{\TextOrMath{$\alpha$}{\alpha}} Then we can use \Gra both in text and math to produce α.

Read the discussion in Sections A.1.6 and A.2.6 where to put your custom com- mand file.

Dokumen yang terkait

c. Bridging Teknik memanjat pada celah vertikal yang lebih besar (gullies). Caranya dengan menggunakan kedua tangan dan kaki sebagai pegangan pada kedua celah tersebut. Posisi badan mengangkang kaki sebagai tumpuan dibantu juga tangan sebagai penjaga kese

0 1 10

2. Marah: adalah kunci setiap kejahatan. Nabi saw. telah berpesan pada seseorang untuk menjauhi sikap marah dengan sabda beliau: "Janganlah engkau marah". Beliau mengulanginya berkali-kali. (H.R Bukhari). - Kebersihan Hati

2 5 14

Object Oriented Programming dengan Delphi (

1 4 75

E volusi dan aplikasi sistem informasi berbasis komputer

1 8 18

b. Data Manipulation Language (DML) : Digunakan untuk memanipulasi data dengan menggunakan perintah : select, - SISTEM BASIS DATA 1.rar (7,386Kb)

1 3 15

Hubungan Pola Asuh Orang Tua dan Kesiapan Psikologis Anak dengan Kebersihan Toilet Traning pada Anak Usia Prasekolah di Paud Ab-Arisalah Kota Lubuklinggau

0 1 8

Hubungan Pengetahuan dsn Sikap dengan Tindakan Hygiene Penjual makanan Jajanan di Lingkungan Sekolah Dasar Kaamatan Baturaja Timur Kabupaten Ogan Komering UIU Tahun 2013 A. Gani

1 3 14

Faktor faktor yang berhubungan dengan manfaatan Posyandu lansia oleh kelompok usia lanjut didesa Kemalara dalam wilayah kerja Puskesmas Kemalaraja OKU Tahun 2013. Saprianto, M.Kes

3 3 21

Korelasi umur, pekerjaan, dan keberadaan kontainer dengan kejadian penyakit malaria di desa simpang Martapura wilayah Kabupaten Ogan Komering Ulu Selatan tahun 2014 – A. Gani

0 0 18

Pengaruh Ekstrak Daun Jambu Biji (Psidiu Guajava Linn) dan Ekstrak daun Teh Hijau (Camelia Sinensis) terhadap Pertumbuhan Escherichia Coli In Vitro dan Perbandingannya dengan Kotrimoksazol

2 16 20