L A T EX in the Classroom Dan Raies The University of Oregon - - PowerPoint PPT Presentation

l a t ex in the classroom
SMART_READER_LITE
LIVE PREVIEW

L A T EX in the Classroom Dan Raies The University of Oregon - - PowerPoint PPT Presentation

Introduction Welcome L A T EX in the Classroom Dan Raies The University of Oregon Wednesday, July 20, 2014 Dan Raies (The University of Oregon) L T EX in the Classroom Wednesday, July 20, 2014 1 / 33 A Introduction Original Motivation


slide-1
SLIDE 1

Introduction Welcome

L

AT

EX in the Classroom

Dan Raies

The University of Oregon

Wednesday, July 20, 2014

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 1 / 33

slide-2
SLIDE 2

Introduction Original Motivation

Problem: This homework assignment written by an associate professor: http://pages.uoregon.edu/vvologod/hw3.pdf

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 2 / 33

slide-3
SLIDE 3

Introduction Original Motivation

Problem: This homework assignment written by an associate professor: http://pages.uoregon.edu/vvologod/hw3.pdf Solution: I created an packet of useful information and a one-hour talk designed to introduce L

AT

EX by examining the challenges which face new teachers. That packet can be found here: http://pages.uoregon.edu/raies/latex.html

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 2 / 33

slide-4
SLIDE 4

Introduction Today’s Goals

You campaign in poetry. You govern in prose. – Mario Cuomo Today we want to look at some of the problems that a teacher who just learned L

AT

EX might face. The goal is to look for solutions which are simple and accessible rather than those which are elegant and general.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 3 / 33

slide-5
SLIDE 5

Introduction The Basics

Here is a sample of some early concepts that I won’t discuss today: horizontal and vertical spacing units (the siunitx package) margins, headers, and footers labels and the hyperref package equation numbering (or not) creating custom commands beamer

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 4 / 33

slide-6
SLIDE 6

The enumerate environment Problem

Problem: How do I make the enumerate environment pick up where it last left off?

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 5 / 33

slide-7
SLIDE 7

The enumerate environment Problem

Problem: How do I make the enumerate environment pick up where it last left off? Why? Different sections of exams often need different instructions but the numbering should be contiguous throughout.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 5 / 33

slide-8
SLIDE 8

The enumerate environment Solution

Solution: The enumitem package and the resume option provides exactly the desired behavior.

\ documentclass {article} \ usepackage{enumitem} \begin{document} \begin{enumerate} \item One \item Two \end{enumerate} \begin{enumerate }[ resume] \item Three \item Four \end{enumerate} \end{document}

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 6 / 33

slide-9
SLIDE 9

The enumerate environment Implementation

True or False:

  • 1. All p-groups are solvable.
  • 2. A5 has a unique Sylow 5-subgroup.

Fill in the blank:

  • 3. D3 has

normal subgroups.

  • 4. S5 has

conjugacy classes.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 7 / 33

slide-10
SLIDE 10

The enumerate environment Related Ideas

The enumitem package also provides options to change the labels in the enumerate environment.

% Labels will look like (I), (II), ... \begin{enumerate }[ label =(\ Roman *)] \item One \item Two \end{enumerate}

Note: The enumitem and enumerate packages conflict.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 8 / 33

slide-11
SLIDE 11

Shared Styling Problem

Problem: I have n documents with different content but identical formatting. How can I structure these documents so that a small change in the formatting doesn’t require me to edit n different .tex files?

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 9 / 33

slide-12
SLIDE 12

Shared Styling Problem

Problem: I have n documents with different content but identical formatting. How can I structure these documents so that a small change in the formatting doesn’t require me to edit n different .tex files? Why? “I wrote 23 homework assignments. Then I decided to change the spacing between the questions so I changed all 23 homework assignments. Then I realized that I forgot to put a place for their names so I changed all 23 homework assignments. Then a student noticed a typo in the footer. . . ”

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 9 / 33

slide-13
SLIDE 13

Shared Styling Solution

Solution: Of the many solutions to this problem, a common preamble is my preference in a teaching environment (until Kaveh saves the day).

\ documentclass {article} \input{math 112_ hw_preamble} \begin{document} % content \end{document}

A file called math112_hw_preamble.tex should contain whatever would normally go in the preamble.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 10 / 33

slide-14
SLIDE 14

Shared Styling Implementation

To the source code!

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 11 / 33

slide-15
SLIDE 15

Shared Styling Related Ideas

The input command is extremely useful for creating modular documents.

\ documentclass {article} \begin{document} \input{ introduction } \input{chapter 1} \input{chapter 2} \input{chapter 3} \end{document}

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 12 / 33

slide-16
SLIDE 16

Answer Keys Problem

Problem: How can I create a document where the visibility of certain content is

  • ptional?

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 13 / 33

slide-17
SLIDE 17

Answer Keys Problem

Problem: How can I create a document where the visibility of certain content is

  • ptional?

Why? After giving an exam an instructor might provide solutions to his or her

  • students. Most instructors do this by creating and compiling a second

.tex file. However, it is usually a bad idea to put identical content in two different places.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 13 / 33

slide-18
SLIDE 18

Answer Keys Solution

Solution 1: The solution below is best for a homework assignment where there is no spacing between questions.

% preamble to compile an " assignment " \ newcommand {\ answer }[1]{} %%% OR %%% % preamble to compile a "key" \ newcommand {\ answer }[1]{\ fbox{Answer :} #1} ... %body What is the capitol

  • f Oregon? \answer{Salem}

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 14 / 33

slide-19
SLIDE 19

Answer Keys Solution

Solution 2: The solution below is best for an exam where the document leaves room for students’ answers.

% preamble to compile an "exam" \ newcommand {\KC }[2]{#1} %%% OR %%% % preamble to compile a "key" \ newcommand {\KC }[2]{#2} ... %body What is the capitol

  • f Oregon?

\KC{\ vfill }{\ answer{Salem }}

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 15 / 33

slide-20
SLIDE 20

Answer Keys Implementation

To the source code!

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 16 / 33

slide-21
SLIDE 21

Answer Keys Related Ideas

A similar trick can be used to manage different versions of an exam.

% preamble to compile " version 1" \ newcommand {\VC }[2]{#1} %%% OR %%% % preamble to compile " version 2" \ newcommand {\VC }[2]{#2} ... %body What is the capitol

  • f \VC{Ohio }{ Oregon }?

\KC{\ vfill }{\ answer {\VC{Columbus }{ Salem }}}

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 17 / 33

slide-22
SLIDE 22

Images Problem

Problem: How can I put the graph of a function in my L

AT

EX document?

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 18 / 33

slide-23
SLIDE 23

Images Problem

Problem: How can I put the graph of a function in my L

AT

EX document? Why? . . . because I’m a mathematician. . .

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 18 / 33

slide-24
SLIDE 24

Images Solution

Half-Hearted Solution: The includegraphics command allows the user to import graphics from

  • ther sources.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 19 / 33

slide-25
SLIDE 25

Images Solution

Half-Hearted Solution: The includegraphics command allows the user to import graphics from

  • ther sources.

. . . but there are advantages to creating graphics within L

AT

EX.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 19 / 33

slide-26
SLIDE 26

Images Solution

Research Solution: There are many. The pgfplots package provides one shown below.

\begin{ tikzpicture }[ scale =0.5] \begin{axis }[ xlabel ={$x$}, ylabel ={$y=f(x)$}] \addplot[blue ,domain = -3:3] {x^2-x+4}; \end{axis} \end{ tikzpicture }

−3 −2 −1 1 2 3 5 10 15 x y = f (x)

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 20 / 33

slide-27
SLIDE 27

Images Solution

Teaching Solution: The tikz package and plot.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 21 / 33

slide-28
SLIDE 28

Images Solution

Teaching Solution: The tikz package and plot. First: What is different about teaching? The other solutions provide high-level (*ahem*) computation and a convenient (*ahem*) syntax. However, when teaching we can often sacrifice those luxuries for visual control.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 21 / 33

slide-29
SLIDE 29

Images Solution

So how do we do it? As with the pgfplots package, the magic happens within a tikzpicture environment. The code. . .

\begin{ tikzpicture } \draw (0,-1) grid (4 ,2); \draw plot[domain =0:4]({\x},{sin (\x r)}); \end{ tikzpicture }

. . . produces. . .

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 22 / 33

slide-30
SLIDE 30

Images Implementation

The next few frames are examples of graphs that I’ve used in which the tikz package thrives and other methods struggle.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 23 / 33

slide-31
SLIDE 31

Images Implementation x 9 y

y = f (x) y = g(x) (9, (f + g)(9)) g(9) f (9) g(9)

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 24 / 33

slide-32
SLIDE 32

Images Implementation x y Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 25 / 33

slide-33
SLIDE 33

Images Implementation x y

  • 4
  • 3
  • 2
  • 1

1 2 3 4

y = 3 y = 1 y = 0.5 y = 1.5 y = f (x) (0.19, 1.5) (1.81, 1.5)

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 26 / 33

slide-34
SLIDE 34

Images Implementation −720◦ −540◦ −360◦ −180◦ 180◦ 360◦ 540◦ 720◦

  • 4
  • 3
  • 2
  • 1

1 2 3 4 x y Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 27 / 33

slide-35
SLIDE 35

Images Related Ideas

The tikz package (with its relatives) is a wide net that catches many problems, though it doesn’t always provide the “best” solution. It is my go-to package for. . . functions, geometry diagrams, commutative diagrams, and force diagrams. There are, of course, many other applications.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 28 / 33

slide-36
SLIDE 36

Students and L

A

T EX Problem

Problem: How can I get my freshmen to try L

AT

EX?

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 29 / 33

slide-37
SLIDE 37

Students and L

A

T EX Problem

Problem: How can I get my freshmen to try L

AT

EX? Why would I ever do that to myself? Document creation is a valuable skill and L

AT

EX is cool.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 29 / 33

slide-38
SLIDE 38

Students and L

A

T EX Problem

Problem: How can I get my freshmen to try L

AT

EX? Why would I ever do that to myself? Document creation is a valuable skill and L

AT

EX is cool. Why is this a problem? Our deepest fear is not that we are inadequate. Our deepest fear is that we are powerful beyond measure. – Marianne Williamson

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 29 / 33

slide-39
SLIDE 39

Students and L

A

T EX Solution

Solution: My solution is writelatex.com. There are two useful features: The unpleasant “installation” process is replaced with the easier and more familiar “sign-up” process. It is trivial to access students’ source code.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 30 / 33

slide-40
SLIDE 40

Students and L

A

T EX Implementation

To the internet!

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 31 / 33

slide-41
SLIDE 41

Students and L

A

T EX Related Ideas

Unfortunately, writeL

AT

EX is the worst of all worlds for the experienced user. Compile timeouts suck. Like, a lot. The writeL

AT

EX front-end is very sad when compared to dedicated IDE’s. Version control systems are likely preferred for collaboration. (Though writeL

AT

EX does support version control.) The paid version of writeL

AT

EX is noticeably more impressive than the free version. Unfortunately, writeL

AT

EX requires an internet connection. This also makes it slow. . . . you get the point.

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 32 / 33

slide-42
SLIDE 42

Students and L

A

T EX Related Ideas

Unfortunately, writeL

AT

EX is the worst of all worlds for the experienced user. Compile timeouts suck. Like, a lot. The writeL

AT

EX front-end is very sad when compared to dedicated IDE’s. Version control systems are likely preferred for collaboration. (Though writeL

AT

EX does support version control.) The paid version of writeL

AT

EX is noticeably more impressive than the free version. Unfortunately, writeL

AT

EX requires an internet connection. This also makes it slow. . . . you get the point. There are, however, two places where I find writeL

AT

EX extremely useful:

  • n my Android smartphone
  • n an unfamiliar computer

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 32 / 33

slide-43
SLIDE 43

The End

I don’t know half of you half as well as I should like; and I like less than half of you half as well as you deserve. – The Hobbit

Dan Raies (The University of Oregon) L

A

T EX in the Classroom Wednesday, July 20, 2014 33 / 33