23
More Package adding info User Definables Graphics Lecture 7 - Additional Packages Info and User-Definables L A T E X for Math and Science Christian Blanco and Brandon Eltiste Spring 2011 Lecture 7 L A T E X for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Lecture 7 - Additional Packages Info andUser-Definables

LATEX for Math and ScienceChristian Blanco and Brandon Eltiste

Spring 2011 Lecture 7

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 2: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Outline

1 More Package adding info

2 User Definables

3 Graphics

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 3: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Adding local tex folder

TeXLive and MikTeX have the capability of letting users placepackages outside of the installation paths. This is convenientwhen neither programs install the packages automatically. Also,in Windows you do not need to run a program as administrator,which is the most compelling reason to do this. There is alsoless digging for the actual folder or file.

TeXLive InstructionsMikTeX Instructions

Note that you only need to run texhash after the first time youadd a package, and not each time you edit the package. Also,the folder you point as a root must contain tex\latex, whichis where you place packages, you can place them in their ownfolders or just the latex folder.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 4: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Who cares?

What if a math command like sin, \sin is not defined foryour operator, e.g. \dom, \ran, or \Res?What if I am too lazy to write out the whole command?What if I don’t like the look of the existing command?

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 5: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Who cares?

What if a math command like sin, \sin is not defined foryour operator, e.g. \dom, \ran, or \Res?What if I am too lazy to write out the whole command?What if I don’t like the look of the existing command?

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 6: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Who cares?

What if a math command like sin, \sin is not defined foryour operator, e.g. \dom, \ran, or \Res?What if I am too lazy to write out the whole command?What if I don’t like the look of the existing command?

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 7: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Who cares?

What if a math command like sin, \sin is not defined foryour operator, e.g. \dom, \ran, or \Res?What if I am too lazy to write out the whole command?What if I don’t like the look of the existing command?

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 8: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

DeclareMathOperator

So LATEX doesn’t have \dom or \ran, built-in, so that is what\DeclarMathOperator is for.Simply place \DeclareMathOperator{\dom}{dom} and\DeclareMathOperator{\ran}{ran} in the preamble ontheir own lines.Now you can use \dom x and \ran x, which look like dom xand ran x respectively.The importance is that \DeclareMathOperator makes thetext upright and adds a small space after the command.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 9: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

DeclareMathOperator∗

So the default behavior for subscripts and superscripts for\DeclareMathOperator is ranx and domx .What if I want it to be like \sum, i.e.

∞∑n

?

Use \DeclareMathOperator*. For example,\DeclareMathOperator*{\Res}{Res}. So it will appearas

Resz=0

1z

?

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 10: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The similarities between newcommand,renewcommand, and providecommand

These commands each have the same declarations:

\*command{\Name}[NumberOfArguments]{The command}

A couple examples\newcommand{\bbR}{\ensuremath{\mathbb{R}}}results in R when you type $\bbR$.

\newcommand{\dotssub}[3]{\ensuremath{{#1}_{#2} \dotsc {#1}_{#3}}}results in a1an when you type \dotssub{a}{1}{n}.

\newcommand{\Iff}{if\textcompwordmark f\xspace}results in iff when you type \Iff.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 11: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The similarities between newcommand,renewcommand, and providecommand

These commands each have the same declarations:

\*command{\Name}[NumberOfArguments]{The command}

A couple examples\newcommand{\bbR}{\ensuremath{\mathbb{R}}}results in R when you type $\bbR$.

\newcommand{\dotssub}[3]{\ensuremath{{#1}_{#2} \dotsc {#1}_{#3}}}results in a1an when you type \dotssub{a}{1}{n}.

\newcommand{\Iff}{if\textcompwordmark f\xspace}results in iff when you type \Iff.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 12: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The similarities between newcommand,renewcommand, and providecommand

These commands each have the same declarations:

\*command{\Name}[NumberOfArguments]{The command}

A couple examples\newcommand{\bbR}{\ensuremath{\mathbb{R}}}results in R when you type $\bbR$.

\newcommand{\dotssub}[3]{\ensuremath{{#1}_{#2} \dotsc {#1}_{#3}}}results in a1an when you type \dotssub{a}{1}{n}.

\newcommand{\Iff}{if\textcompwordmark f\xspace}results in iff when you type \Iff.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 13: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The similarities between newcommand,renewcommand, and providecommand

These commands each have the same declarations:

\*command{\Name}[NumberOfArguments]{The command}

A couple examples\newcommand{\bbR}{\ensuremath{\mathbb{R}}}results in R when you type $\bbR$.

\newcommand{\dotssub}[3]{\ensuremath{{#1}_{#2} \dotsc {#1}_{#3}}}results in a1an when you type \dotssub{a}{1}{n}.

\newcommand{\Iff}{if\textcompwordmark f\xspace}results in iff when you type \Iff.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 14: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The similarities between newcommand,renewcommand, and providecommand

These commands each have the same declarations:

\*command{\Name}[NumberOfArguments]{The command}

A couple examples\newcommand{\bbR}{\ensuremath{\mathbb{R}}}results in R when you type $\bbR$.

\newcommand{\dotssub}[3]{\ensuremath{{#1}_{#2} \dotsc {#1}_{#3}}}results in a1an when you type \dotssub{a}{1}{n}.

\newcommand{\Iff}{if\textcompwordmark f\xspace}results in iff when you type \Iff.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 15: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The differences between newcommand,renewcommand, and providecommand

\newcommand will stop if the command has been declaredbefore by another package. \newcommand will return anerror if it does find it has already been declared.\renewcommand will overwrite any command declaredbefore, and not warn you that it overwrote it. Be carefulwith this command.\providecommand is like newcommand, but doesn’t warnyou if it has been declared before. This is the safest to use,and should be used most often.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 16: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The differences between newcommand,renewcommand, and providecommand

\newcommand will stop if the command has been declaredbefore by another package. \newcommand will return anerror if it does find it has already been declared.\renewcommand will overwrite any command declaredbefore, and not warn you that it overwrote it. Be carefulwith this command.\providecommand is like newcommand, but doesn’t warnyou if it has been declared before. This is the safest to use,and should be used most often.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 17: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The differences between newcommand,renewcommand, and providecommand

\newcommand will stop if the command has been declaredbefore by another package. \newcommand will return anerror if it does find it has already been declared.\renewcommand will overwrite any command declaredbefore, and not warn you that it overwrote it. Be carefulwith this command.\providecommand is like newcommand, but doesn’t warnyou if it has been declared before. This is the safest to use,and should be used most often.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 18: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

The differences between newcommand,renewcommand, and providecommand

\newcommand will stop if the command has been declaredbefore by another package. \newcommand will return anerror if it does find it has already been declared.\renewcommand will overwrite any command declaredbefore, and not warn you that it overwrote it. Be carefulwith this command.\providecommand is like newcommand, but doesn’t warnyou if it has been declared before. This is the safest to use,and should be used most often.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 19: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Keep the following in mind

When you want to change an existing command, do\providecommand{\myemptyset}{\varnothing}rather than\renewcommand{\emptyset}{\varnothing}.These can make your tex file easier to read for yourself,but not for others.When sharing do one of the following:

Make sure the commands declared are in the preamble.OR do a find and replace for the commands declared.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 20: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Keep the following in mind

When you want to change an existing command, do\providecommand{\myemptyset}{\varnothing}rather than\renewcommand{\emptyset}{\varnothing}.These can make your tex file easier to read for yourself,but not for others.When sharing do one of the following:

Make sure the commands declared are in the preamble.OR do a find and replace for the commands declared.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 21: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Keep the following in mind

When you want to change an existing command, do\providecommand{\myemptyset}{\varnothing}rather than\renewcommand{\emptyset}{\varnothing}.These can make your tex file easier to read for yourself,but not for others.When sharing do one of the following:

Make sure the commands declared are in the preamble.OR do a find and replace for the commands declared.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 22: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Keep the following in mind

When you want to change an existing command, do\providecommand{\myemptyset}{\varnothing}rather than\renewcommand{\emptyset}{\varnothing}.These can make your tex file easier to read for yourself,but not for others.When sharing do one of the following:

Make sure the commands declared are in the preamble.OR do a find and replace for the commands declared.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables

Page 23: Lecture 7 - Additional Packages Info and User-Definableslatex/files/lecture7march14.pdf · More Package adding infoUser DefinablesGraphics Outline 1 More Package adding info 2 User

More Package adding info User Definables Graphics

Keep the following in mind

When you want to change an existing command, do\providecommand{\myemptyset}{\varnothing}rather than\renewcommand{\emptyset}{\varnothing}.These can make your tex file easier to read for yourself,but not for others.When sharing do one of the following:

Make sure the commands declared are in the preamble.OR do a find and replace for the commands declared.

LATEX for Math and Science Christian Blanco and Brandon Eltiste Lecture 7 - Additional Packages Info and User-Definables