e:/f/latex/cmu 12130610/latex cmu 14150508/latex2006...

150
เอกสารประกอบการอบรม การสร้างเอกสารวิชาการทางคณิตศาสตร์ด้วย โปรแกรมภาษา L A T E X 12 - 13 มิถุนายน พ.ศ. 2553 ภาควิชาคณิตศาสตร์ คณะวิทยาศาสตร์ มหาวิทยาลัยเชียงใหม่

Upload: others

Post on 15-Sep-2019

25 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

เอกสารประกอบการอบรม

การสรางเอกสารวชาการทางคณตศาสตรดวย

โปรแกรมภาษา LATEX

12 - 13 มถนายน พ.ศ. 2553

ภาควชาคณตศาสตร คณะวทยาศาสตร

มหาวทยาลยเชยงใหม

Page 2: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม
Page 3: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

กำหนดการอบรม

การสรางเอกสารวชาการทางคณตศาสตรดวยโปรแกรมภาษา LATEX

วนท 12 - 13 มถนายน พ.ศ. 2553ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม

วนเสารท 12 มถนายน พ.ศ. 255308.00 - 08.30 น. ลงทะเบยน08.30 - 08.45 น. แนะนำโปรแกรมภาษา LATEX

08.45 - 09.15 น. แนะนำขนตอนการลงโปรแกรมภาษา LATEX และโปรแกรมประกอบ09.15 - 10.00 น. ประวต และความเปนมาของโปรแกรมภาษา LATEX

10.00 - 10.15 น. พก10.15 - 12.00 น. การสรางสญลกษณทางคณตศาสตรดวยโปรแกรมภาษา LATEX (1)12.00 - 13.00 น. พกรบประทานอาหารกลางวน13.00 - 15.00 น. การสรางสญลกษณ ทางคณตศาสตรดวยโปรแกรมภาษา LATEX (2)15.00 - 15.15 น. พก15.15 - 17.15 น. การสรางสญญลกษณ ทางคณตศาสตรดวยโปรแกรมภาษา LATEX (3)

วนอาทตยท 13 มถนายน 255308.30 - 10.00 น. การสรางสญลกษณ ทางคณตศาสตรดวยโปรแกรมภาษา LATEX (4)10.00 - 10.15 น. พก10.15 - 12.00 น. การจดรปแบบเอกสาร (1)12.00 - 13.00 น. พกรบประทานอาหารกลางวน13.00 - 15.00 น. การจดรปแบบเอกสาร (2)15.00 - 15.15 น. พก15.15 - 16.15 น. LATEX กบงาน Graphics16.15 - 17.15 น. การสรางเอกสารวชาการทางคณตศาสตรภาษาไทยดวยโปรแกรมภาษา LATEX

Page 4: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม
Page 5: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

บทท 1

ขนตอนการลงโปรแกรม

มอย 6 ขนตอน คอ

1 การลงโปรแกรม Ghostscript viewer (สำหรบเปดไฟลนามสกล ps หรอ eps)

2 การลงโปรแกรม Acrobat Reader (สำหรบเปดไฟลนามสกล pdf)

3 การลงโปรแกรม LATEX (ในทนเลอกใช MiKTEX2.7)

4 การลงโปรแกรม Text Editor on Windows (ในทนเลอกใช WinEdt 5.5)

5 การทดสอบการลงโปรแกรม

6 การตดตง Thai LATEX และการใชงานภาษาไทยบน WinEdt

Page 6: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

1.1 การลงโปรแกรม Ghostscript viewerมดวยกน 2 ขนตอนยอย คอ

1 การตดตง Ghostscript (GS800W32.EXE) “ผดำ”2 การตดตง GSview (GSV43W32.EXE) “ผขาว”

หมายเหต “ผดำกอนผขาว”

1.1.1 การตดตง Ghostscript1. ลอกอนเขาเครองคอมพวเตอรดวย username: “Administrator”2. เลอก (Double clicks) ท “GS800W32.EXE” (ผดำ) ซงอยท CD =⇒ Program =⇒ GS new

3. จะปรากฏหนาตาง “WinZip Self Extractor - GS800W32.EXE” ขนดงรป

ทำการกด (Click) ท “Setup” เพอกำหนดรายละเอยดการตดตง Ghostscript

Page 7: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 3

4. จะปรากฏหนาตาง AFPL Ghostscript Setup ขน ซงมขอมลระบถงตำแหนงของ directory สำหรบการตดตง และ Shortcut ทจะถกสรางขน

ใหกด (Click) ท “Install” เพอทำการตดตง Ghostscript

5. เมอการตดตงเสรจสน จะปรากฏหนาดงรปดานลาง ใหทำการปดหนาตางดงกลาวซงถงวาเสรจสนการตดตง Ghostscript

Page 8: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

4 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

1.1.2 การตดตง GSview1. เลอก (Double clicks) ท “GSV43W32.EXE” (ผขาว) ซงอยท CD =⇒ Program =⇒ GS new

2. จะปรากฎหนาตาง “WinZip Self Extractor - GSV43W32.EXE” ขนดงรป

กด (Click) ท “Setup” เพอเรมการกำหนดขอมลการตดตง GSview

Page 9: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 5

3. เลอกภาษา ในการใชงาน โดยเลอกท “English”

4. กด (Click) ท “Next >” เพอไปในขนตอนตอไป

Page 10: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

6 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

5. กด (Click) ท “Next >” เพอไปในขนตอนตอไป

6. จะปรากฏหนาตางแสดงชนดของไฟลทจะถกนำมาแสดงผลดวย GSviewใหเลอก “Associate Postscript . . .” เพยงอยางเดยว แลวกด (Click) ท “Next >” เพอไปในขนตอนตอไป

7. จะปรากฏหนาตาง เพอใหระบตำแหนงของ directory ของการตดตงโปรแกรม (นยมกำหนดตามทใหมา)กด (Click) ท “Next >” เพอไปในขนตอนตอไป

Page 11: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 7

8. จะปรากฏหนาตาง เพอกำหนด ชอของ Folder ใน Start Menu (นยมกำหนดตามทใหมา)กด (Click) ท “Finish >” เพอเรมทำการตดตงโปรแกรม ตามทกำหนดมาขางตน

Page 12: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

8 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

9. เมอโปรแกรมตดตงเสรจสนแลวจะปรากฏหนาตาง ดงขางลางนขน ใหทำการปดหนาตางดงกลาว

10. แตจะยงคงมหนาตาง ทแสดง “Installation successful” อยใหทำการ กด (Click) ท “Exit” เพอออกจากการตดตงโปรแกรม

Page 13: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 9

1.2 การลงโปรแกรม Acrobat Readerเลอก (Double clicks) ท ar812lite US.exe ซงอยท CD =⇒ Program =⇒ Adobe.Reader.v8.1.2.Lite.Eng.

Page 14: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

10 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

1.3 การลงโปรแกรม LATEX (MiKTEX2.7)1. เลอก (Double Clicks) ท “Setup-2.7.2960.exe” ซงอยท CD =⇒ Program =⇒ miktex27

2. จะปรากฏหนาตาง “MiKTEX 2.7.2950 Installer: Copying Conditions” ขนทำการเลอกท “I accept the MiKTEX copying conditions.”แลว กด (Click) ท “Next >” เพอดำเนนการตอไป

Page 15: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 11

3. เลอกการตดตงแบบ “Complete MiKTEX ”แลว กด (Click) ท “Next >” เพอดำเนนการตอไป

4. เลอกตดตงสำหรบทกคนใชงานได โดยเลอกท “Anyone who users this computer (all users) ”แลว กด (Click) ท “Next >” เพอดำเนนการตอไป

Page 16: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

12 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

5. ทำการกำหนด “Installation Directory ” (นยมกำหนดตามทใหมา)แลวกด (Click) ท “Next >” เพอดำเนนการตอไป

6. ทำการกำหนด1. Preferred paper ใหเลอกเปน “A4 ”2. Install missing packages on-the-fly ใหเลอกเปน “Ask me first ”

แลวกด (Click) ท “Next >” เพอดำเนนการตอไป

Page 17: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 13

7. กด (Click) ท “Start” เพอเรมการตดตงโปรแกรม MiKTEX2.7(ขนตอนดงกลาวจะใชเวลามากนอยเพยงใดจะขนอยกบประสทธภาพของเครองคอมพวเตอรเครองนนๆ)

8. เมอการตดตงแลวเสรจ ปม “Next >”จะสามารถทำงานได ใหกด (Click) ท “Next >”

Page 18: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

14 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

9. จะปรากฎหนาตาง “Completing The MiKTEXSetup Wizard” ขนใหกด (Click) ท “Close” ซงถอวา การตดตง MiKTEX2.7 เสรจสนสมบรณ

Page 19: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 15

1.4 การลงโปรแกรม Text Editor on Windowns (WinEdt 5.5)

1. เลอก (Double clicks) ท “winedt55.exe” ซงอยท CD =⇒ Program

2. จะปรากฎหนาตาง “Welcome to the WinEdt Setup Wizard” ขนกด (Click) ท “Next >” เพอดำเนนการตอไป

Page 20: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

16 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

3. หนาตาง “License Agreement” จะปรากฏขนใหเลอก “I accept the agreement” แลว กด (Click) ท “Next >” เพอดำเนนการตอไป

4. หนาตาง “Information” จะปรากฏขน ใหกด (Click) ท “Next >” เพอดำเนนการตอไป

Page 21: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 17

5. หนาตาง “Select Destination Location” จะปรากฏขน เพอใหระบตำแหนงทตองการตดตงโปรแกรม(นยมใชตามทกำหนดมา) แลว กด (Click) ท “Next >”

6. หนาตาง “Select Start Menu Folder” จะปรากฏขน เพอใหกำหนด ชอ Folder บน Start Menuของคอมพวเตอร (นยมใชตามทกำหนดมา) แลว กด (Click) ท “Next >”

Page 22: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

18 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

7. หนาตาง “Select Additional Tasks” จะปรากฎขน ใหทำการเลอกทงหมดแลว กด (Click) ท “Next >”

8. หนาตาง “Ready to Install” จะปรากฎขน ซงจะแสดงสงทเรากำหนดไว สำหรบการตดตงโปรแกรมให กด (Click) ท “Install” เพอเรมการตดตงโปรแกรม

Page 23: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 19

9. หนาตาง “Installing” จะปรากฎขน เพอแสดงสถานะการทำงานของการตดตงโปรแกรม“โปรดรอ จนกระทงการตดตงโปรแกรมเสรจสน”

10. หนาตาง “CompletingtheWinEdtSetupWizard” จะปรากฎขน ซงแสดงวาการตดตงเสรจสมบรณแลวใหกด (Click) ท “Finish” เพอจบการตดตงโปรแกรม

Page 24: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

20 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

1.5 การทดสอบการลงโปรแกรม1. เปดโปรแกรม WinEdt ขนมา

2. ไปท New ใน File ของ Menu Bar (File =⇒ New)

3. พมพขอความดงขางลางน

\documentclassarticle

\begindocument

Hello \LaTeX world!

\enddocument

Note: LATEX is a case-sensitive.

4. ทำการบนทก (Save) โดยใหชอวา “hello.tex”.

5. กด (Click) ท “TEXify” หรอ “หวสงห” เพอใหโปรแกรมทำการประมวลผลโดย ผลลพธทไดเปน ไฟลนามสกล dvi ซงจะถกเปดอานดวยโปรแแรม yap หรอ

อาจจะกด (Click) ท “PDF TEXify” เพอใหโปรแกรมทำการประมวลผลโดย ผลลพธทไดเปน ไฟลนามสกล pdf ซงจะถกเปดอานดวยโปรแแรม Acrobat

Page 25: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 21

1.6 การตดตง Thai LATEX และการใชงานภาษาไทยบนWinEdt

1.6.1 การตดตง Thai LATEX

1. เปด My Computer แลวเลอกเปด Drive C:2. เปด My Computer แลวไปท

CD =⇒ Program =⇒ เปา2009 Miktex2.7 =⇒ copy2C

3. คดลอก (Copy) Folders: localtexmf, Program Files และ ThaiMikTeX จาก Windowsในขนตอนท 2 ไปท C: (windows ในขนตอนท 1)

Page 26: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

22 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

4. คดลอก (Copy) “thai2.bat” จาก Windows ในขนตอนท 2 ไปท Desktop ของเครองคอมพวเตอร

5. ปด Windows ทงหมด (ในขนตอนท 1 และ 2)6. กด (Click) ท “thai2.bat” ทอยบน Desktop และ รอจนกระทงหนาตางพนสดำหายไปเอง

Page 27: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 23

7. เปด “Settings”ซงอยท Start =⇒ Programs =⇒MiKTeX2.7

8. จะมหนาตาง “MiKTeX Options” ปรากฎขนกดท “Refresh FNDB” ซงอยภายใตหวขอ “General” (ใหกดซำ ประมาณ 3 ครง)

Page 28: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

24 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

9. ไปทหวขอ “Roots” เลอก “Add. . .”

9. จะปรากฏหนาตาง “Browse for Folder” ขนใหไปท Drive C: เลอก “localtexmf” แลว กด (Click) ท OK

Page 29: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 25

10. ใน “Path” จะปรากฎอย 2 รายชอ คอ C:\Program Files\MiXTeX2.7 และ C:\localtexmfแลว กด (Click) ท OK ซงจะถอวาเปนการเสรจสนการลงโปรแกรมในสวนของ Thai LATEX

Page 30: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

26 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

1.6.2 การพมพภาษาไทยในโปรแกรม WinEdt1. เปด “WinEdt”2. เลอกท “Options” แลวไปท “Preferences...”3. เลอก “Font” และ “Font...” อกครง4. เปลยน “Font” ไปเปน “Fixedsys” แลว กด (Click) ท “OK”5. กด (Click) ท “OK” อกครง เพอเสรจสน

หมายเหต กอนเรมใชเราตองประกาศ

\documentclass[...]...

\usepackage[english,thai]babel

\usepackagethswitch

\begindocument

...

\enddocument

การเปลยนแบบอกษร

1. ใช \def\thairmdefaultFont name

เพอกำหนดรปแบบอกษรมาตรฐาน ทใชงาน

2. ใช \usefontLTHFont namemn

เพอทำการเปลยนรปแบบอกษร ณ ตำแหนงตางๆ ภายใน ไฟล LaTeX

Page 31: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

บทท 2

Typesetting Mathematics in LATEX

2.1 Characters2.1.1 Letter

มอย 52 ตวอกษร:

a b c . . . z A B C . . . Z

2.1.2 Digitมอย 10 หมายเลข:

0 1 2 . . . 9

2.1.3 Punctuationมอย 8 เครองหมาย:

, ; . ? ! : ’ -

2.1.4 Parenthesesมอย 4 แบบ:

( ) [ ]

2.1.5 Basic math operatorsมอย 5 สญลกษณ:

/ * + = -

Page 32: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

28 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.1.6 Special Charactersมอยดวยกน 11 ตว คอ

\ # $ % ˆ ˜ & |

Character ความหมาย การพมพ\ command character \textbackslash, \backslash# parameter character in TEX \#$ math shift character \$% comment character \%ˆ superscript in math \ˆ

subscript in math \ local group open \ local group close \˜ unbreakable space \˜ , \tilde, \texttilde& ระบตำแหนง \&| \|

2.1.7 Math symbolsในการพมพสญญลกษณทางคณตศาสตรนน เราจะตองพมพในลกษณะของคำสง (command)

เชน (ศกษาเพมเตมได ในเอกสารแนบ)

α = \alphaβ = \betaa = \"aa = \’a§ = \S¶ = \P

Page 33: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 29

2.2 Typing math2.2.1 Inline Mathematics

กรณทตองการพมพ สญลกษณทางคณตศาสตรใหอยในบรรทดเดยวกนกบ ขอความอนๆเราจะใชคำสง

$ . . . . . . $

เชนAdd a squared and b squared to get c

squared. Or using a more mathematical ap-proach: c2 = a2 + b2.

Add $a$ squared and $b$ squared to get$c$ squared. Or using a more mathematicalapproach: $cˆ2 = aˆ2 + bˆ2$.

2.2.2 Display Mathematicsกรณทตองการพมพ สญลกษณทางคณตศาสตรใหอยกงกลางของบรรทด เราจะใชคำสง

\[ . . . . . . \] หรอ $$ . . . $$

เชนAdd a squared and b squared to get c

squared. Or using a more mathematical ap-proach:

c2 = a2 + b2.

Add $a$ squared and $b$ squared toget $c$ squared. Or using a moremathematical approach: \[cˆ2 = aˆ2+ bˆ2\].

2.2.3 PackagePackage ทนยมใชรวมกบ การพมพสญลกษณทางคณตศาสตร ไดแก

amsmath amssymb

รปแแบคำสงในการประกาศใช package น:

\usedpackageamsmath,amssymb

2.2.4 Math Alphabetsอกขระทางคณตศาสตรมคำสงดงน

Commanded Result\mathbf PAT PAT

\mathit PAT PAT

\mathsf PAT PAT

\mathrm PAT PAT

\mathtt PAT PAT

\mathnormal PAT PAT

\mathbb PAT PAT

\mathcal PAT PAT\mathscr PAT PAT

\boldsymbol PAT PAT

หมายเหต: \mathscr จะตองใช \usepackage[mathscr]eucal

Page 34: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

30 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.3 Arithmetic Operations2.3.1 +,−, /

a + b ⇒ $a+b$

a− b ⇒ $a-b$

−a ⇒ $-a$

a/b ⇒ $a/b$

2.3.2 ×,÷, ·a× b ⇒ $a \times b$

a÷ b ⇒ $a \div b$

a · b ⇒ $a \cdot b$

2.3.3 Subscripts and Superscriptsตวอกษรหอย (subscript) เราใชคำสง textตวอกษรยก (superscript) เราใชคำสง ˆtext

ตวอยาง

คำสงa1 $a 1$

ai1 $a i 1$xzy $xˆzy$

xi2+j $xˆiˆ2+j$

แบบฝกหด1. พมพ abcd

ai+1 ai + 1

2. พมพ f ′ f ′2 f ′2

3. พมพex2 6= ex2

หมายเหต: \prime

2.3.4 Fractionการเขยนในรปเศษสวน เราใชคำสง

\fracnumeratordenominator

ตวอยาง1 + x2

x

จะใชคำสง \[ \frac 1+xˆ2x \]

ลองใช $ \frac 1+xˆ2x $

Page 35: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 31

หมายเหต คำสงอนๆเกยวกบ Fraction

\dfrac......

\tfrac......

แบบฝกหด พมพ dydx

= x +1

x + 1x

2.3.5 Binomail Coefficients(ab

)⇒ $a \choose b$

(ab

)⇒ $\binomab$

(a

b

)

⇒ $\dbinomab$(ab

)⇒ $\tbinomab$

2.3.6 Ellipses

x1 + x2 + · · ·+ xn

x1, x2, . . . , xn

คำสง คอ

\[x_1 + x_2 + \cdots + x_n\]

\[x_1, x_2, \ldots , x_n\]

คำสงเกยวกบ Ellipses อนๆ:

\vdots \ddots

\dots \dotso

\dotsc \dotsb

\dotsm \dotsi

2.3.7 Intergralsมคำสงพนฐานทงหมด 5 คำสงดงน

\oint \int \iint \iiint \idotsint

ผลลพธทไดคอ ∮ ∫ ∫∫ ∫∫∫ ∫

· · ·∫

แบบฝกหด1. พมพ ∫∫

x12 dx =

4

15x

52 + C

2. พมพ ∫ b

a

f(x)dx = F (b)− F (a)

3. พมพ Evaluate the integral or show that it is divergent:∫∞

−∞xdx

Page 36: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

32 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.3.8 Root and n-Rootเราใชคำสง \sqrt... สำหรบ √· · ·และ \sqrt[n]... สำหรบ n

√· · ·

ตวอยาง\sqrt10xˆ5 ผลลพธคอ

√10x5

\sqrt[6]10xˆ5 ผลลพธคอ 6√

10x5

แบบฝกหด1. พมพ

1 + 4

x2 + 3√

xz+y −√x

x4

2. พมพ √√√√√1 +

√√√√

1 +1

2

1 +1

3

1 +1

4

√1 + · · ·

2.3.9 Congruencesคำสงเกยวกบ modulo

ผลลพธ คำสงa mod b a \bmod b

a ≡ b mod p a \equiv b \modpa ≡ b (mod p) a \equiv b \pmodp

2.3.10 Text in Mathคำสง \mbox... หรอ \text... ใชสำหรบเขยนขอความภายในสวนทเปน

สญญลกษณทางคณตศาสตร เชน ตองการพมพ

A = x | x ∈ xi for some i ∈ I

เราจะใชคำสง คอ\[A = \x \mid x \in x_i \mbox for some i \in \mathcalI\\]

ลองพจารณา 2 คำสงนแตกตางกนอยางไร\[a_\mboxleft + 2 = a_\mboxright\]

\[a_\textleft + 2 = a_\textright\]

2.3.11 Delimiters

ลอง พมพใหไดดงน(

1

2

)

F (x)∣∣∣

b

a

Page 37: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 33

คำสง:

\left( [ \right) ] : ขนาดจะขยายตามสงทอยภายใน ตองอยภายใน \$ $\ldots$ \$

\big \Big

\bigg \Bigg : จะตามดวย ลกษณะของวงเลบทตองการ เชน ( [ |

คำสง ตวอยาง

\big[∫ b

a

f(x)dx]

\Big[ ∫ b

a

f(x)dx]

\bigg

[ ∫ b

a

f(x)dx

]

\Bigg

[∫ b

a

f(x)dx

]

\left[ \right]

[∫ b

a

f(x)dx

]

แบบฝกหด1. พมพ

[∞∑

i=0

] 1p [ ∞∑

i=0

] 1p

2. พมพ((a1b1)− (a2b2)) ((a1b1) + (a2b2))((a1b1)− (a2b2)

)((a1b1) + (a2b2)

)

2.3.12 Math Functionsโดยปกตทวไป ในการพมพฟงกชนทางคณตศาสตรนน จะตองพมพดวย

ตวอกษรแบบ upright font และ ไมเปนตวเอยง เชน

limx→∞

sin(x)

x= 1

หมายเหต รปแบบของตวแปรทางคณตศาสตร จะเปนตวเอยงใน โปรแกรมภาษา LATEX นน ไดกำหนดการพมพฟงกชนทางคณตศาสตร ไวเปน คำสง (Command)

ดงนน การเรยนใชฟงกชนทางคณตศาสตร นนจะตองเรยกใชใหถกตอง\sin \cos \tan \cot

\csc \arcsin \arccos \sinh

\cosh \det \gcd \ln

\lim \liminf \arg . . .

Page 38: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

34 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.3.13 Large Operatorพจารณา

การพมพผลรวม ∑ni=1 และ

n∑

i=1

พบวา เปนการพมพ ในลกษณะทเรยกวา “inline”แตผลทแสดงนนแตกตางกน !!

เราทราบวา การพมพผลรวมตวแรก (∑ni=1) นน เราใชคำสง $\sum_i=1^n$

แตในการพมพตวทสอง (n∑

i=1

) นน เราจะตองใชคำสง

$ \displaystyle \sum_i=1^n $

ตวอยาง

การพมพ∫ ∞

−∞

เราใชคำสง $ \displaystyle \int_-\infty^\infty $

แตหากใชคำสง $ \int_-\infty^\infty $ ผลทไดคอ∫∞

−∞

2.3.14 Multiline Subscripts and Superscriptsในบางกรณเราอาจจำเปนตองพมพสญลกษณทม ตวหอยหลายบรรทด หรอ ตวยกหลายบรรทด เชน

i<ni=even

x2i

i<ni=even∑

x2i

เราจะมชดคำสงทใชพมพ ตวหอยหลายบรรทด หรอ ตวยกหลายบรรทด ในลกษณะเชนน คอ

\substack line 1\\line 2\\...\\line n

จากตวอยาง เราตองพมพ

\[ \sum_\substacki<n\\ i=\textevenx_i^2 \]

\[ \sum^\substacki<n\\i=\texteven x_i^2 \]

แบบฝกหด จงพมพขอความตอไปนn∑

i=1

n∑

j=1j 6=i

E |Iz,ε(WN )− Iz,ε(Wij)| ≤δ

6+

C

σβn

Page 39: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 35

2.3.15 Declaring Operatorsเราสามารถนยามคำสงใหมจากคำสงเกาได โดยการใชคำสง

\DeclareMathOperator\NewCommand\OldCommand \OldCommand

โดยการประกาศใชคำสงนตองประกาศระหวาง \documentclass*** กบ \begindocumentตวอยาง

\documentclassbook\DeclareMathOperator\doublesum\sum+\sum\DeclareMathOperator\sum\displaystyle\sum i=1ˆn\begindocument

ผลลพธจะเปน ∑+∑ กบ

n∑

i=1

เมอเราพมพคำสง $\doublesum$ หรอ $\sumi$

ในตำแหนงทตองการ

2.3.16 Casesพจารณา

γ(v) =

α(V ), if v ∈ V (G1 −H);

β(v), if v ∈ V (G2 −H);

δ(v), if v ∈ H;

คำสงทใช:

\[\gamma(v)=

\begincases

\alpha(V), &\textif~~~v\in V(G_1-H);\\

\beta(v), &\textif~~~v\in V(G_2-H);\\

\delta(v), &\textif~~~v\in H;

\endcases

\]

2.3.17 Horizontal Bracesรปแบบคำสงปกกาบน \overbraceargumentˆsuperscript

ขนาดของปกกา ขนอยกบขนาดของ argument ทเราพมพ เชน

(n+1) terms︷ ︸︸ ︷

a + a + · · ·+ a

เราใชคำสง $$ \overbracea+a+\cdots+aˆ(n+1)˜˜ terms$$

รปแบบคำสงปกกาลาง \underbraceargument superscript จะแสดงผลคลาย ๆ ปกกาบนเชน

a + a + · · ·+ a︸ ︷︷ ︸

(n+1) terms

Page 40: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

36 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

เราใชคำสง $$ \underbracea+a+\cdots +a (n+1)˜˜ terms$$

ลองพมพด $$ \underbracea+a+\cdots + aˆ(n+1) terms$$

Over Lines and Under Lineเราสามารถขดเสนบนและลางอกษร โดยคำสง \overline... กบ \underline...ตวอยาง

x yes

เราใชคำสง \overlinex กบ \underlineyes ตามลำดบ

Over Arrowตวอยาง

←→aa←−bb −→cc

เราใชคำสง

\overleftrightarrowaa สำหรบ ←→aa

\overleftarrowbb สำหรบ ←−bb

\overrightarrowcc สำหรบ −→cc

การเขยนขอความ สญลกษณ บนลกศร

ใชคำสง \xleftarrowthe formula เชน A1−1←−− B

\xrightarrowthe formula เชน A1−1−−→ B

การเขยนสตรลางลกศร

ใชคำสง \xleftarrow[the formula] เชน A←−−onto

B

\xrightarrow[the formula] เชน A −−→onto

B

ตวอยาง (ลอง)

$ A\xrightarrow\text1-1B\xleftarrow[\alpha\to \beta] \textonto C

\xleftarrow[\gamma]D$

ผลลพธA1-1−−→ B

onto←−−−α→β

C ←−γ

D

Page 41: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 37

แบบฝกหดพมพคำสงเพอใหไดผลพทดงตอไปน

1.

(m−n)2

︷ ︸︸ ︷

a + a + · · ·+ a+ b + b + · · ·+ b︸ ︷︷ ︸

n

+

(m−n)2

︷ ︸︸ ︷

c + c + · · ·+ c

︸ ︷︷ ︸

m

2.∞∑

i=1

1 +∑

i<ni even

∫ i

0x dx =∞

3. x ∪ x =−→x

4.n∏

i=1

n⋂

j=1

n⊔

k=1

n⊕

i=1

Page 42: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

38 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.4 สมการ (Equation)รปแบบของการพมพสมการแบงเปน 2 ลกษณะคอ

1 สมการทมการใสหมายเลขอนดบ (numbering)

2 สมการทไมมการใสหมายเลขอนดบ (nonumbering)

2.4.1 สมการทมการใสหมายเลขอนดบ (numbering)แบงเปน 2 แบบคอ

1. หมายเลขอนดบแบบอตโนมตคำสงทใชคอ

\beginequation \beginalign. .

. หรอ .

. .

\endequation \endalign

หมายเหต การใชคำสง \beginalign จะตองประกาศใช \usepackageamsmath เสมอ

ตวอยาง การพมพสมการโดยใชคำสง \beginequation พจารณา

x′(t) = Ax(t) + f(t, x(t)), t 6= ti (2.1)

เราพมพคำสงดงน\beginequation

xˆ \prime(t) = Ax(t) + f(t , x(t)) , t \neq t i\endequation

ตวอยาง การพมพสมการโดยใชคำสง \beginalign พจารณา

f(x) =

∫ 2

0(x2 + 2x− ex)dx (1)

= (x3

3+ x2 − ex)|20 (2)

=23

3− e2 (3)

เราพมพ?คำสงดงน\beginalignf(x) &= \int(xˆ2 + 2x-eˆx) dx \\

&= (\fracxˆ33 + xˆ2+eˆx)| 0ˆ2\\&= \frac233 - eˆ2

\endalign

Page 43: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 39

หมายเหต: 1. ใช \\ ในการขนบรรทดใหม2. ใช & ในการจดตำแหนง3. จะตองไมม บรรทดวาง กอนหนา \endalign

ขอสงเกต ความแตกตางระหวางคำสง \beginequation และคำสง \beginalign คอคำสง \beginequation จะใชสำหรบการพมพสมการภายในบรรทดเดยวกนตลอดแตคำสง \beginalign จะใชสำหรบการพมพสมการ หลายบรรทดตอเนองกน

2. หมายเลขอนดบแบบกำหนดเองเรายงคงใชรปแบบคำสงเหมอนกบ หมายเลขอนดบแบบอตโนมต แตจะใชคำสง \taglabel

ในการกำหนดหมายเลขอนดบ

และใชคำสง \notag ในการละเวนเลขอนดบ

ตวอยาง การพมพสมการโดยใชคำสง \beginequation

x′(t) = Ax(t) + f(t, x(t)), t 6= ti (999)

เราพมพคำสงดงน\beginequationxˆ \prime(t) = Ax(t) + f(t,x(t)) , t \neq t i \tag 999\endequation

ตวอยาง การพมพสมการโดยใชคำสง \beginalign

f(x) =

∫ 2

0(x2 + 2x− ex)dx

= (x3

3+ x2 − ex)|20

=23

3− e2 (b1)

เราพมพคำสงดงน\beginalignf(x) & = \int(xˆ2 + 2x-eˆx) dx \notag \\

& = (\fracxˆ33 + xˆ2+eˆx)| 0ˆ2\notag\\& = \frac233 - eˆ2 \tagb1

\endalign

Page 44: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

40 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.4.2 สมการทไมมการใสหมายเลขอนดบ (nonumbering)รปแบบคำสง คอ

\beginequation* \beginalign*. .

. หรอ .

. .

\endequation* \endalign*

ตวอยาง การพมพสมการโดยใชคำสง \beginequation*

x′(t) = Ax(t) + f(t, x(t)), t 6= ti

เราสามารถพมพคำสงไดดงน\beginequation*

xˆ \prime(t) = Ax(t) + f(t, x(t) ) , t \neq t i\endequation*

หมายเหต \beginequation*...\endequation* มลกษณะคลายกบ \[ . . . \]

ตวอยาง การพมพสมการโดยใชคำสง \beginalign*

f(x) =

∫ 2

0(x2 + 2x− ex)dx

= (x3

3+ x2 − ex)|20

=23

3− e2

เราพมพคำสงดงน\beginalign*f(x) & = \int(xˆ2 + 2x-eˆx) dx \\

& = (\fracxˆ33 + xˆ2 + eˆx)| 0ˆ2 \\& = \frac233 - eˆ2

\endalign*

ตวอยาง ลองพมพสมการตามรปแบบน

x′(t) = Ax(t) + f(t, x(t)), if t 6= ti (2.2)∆x(ti) = Jx(ti), if t = ti, i = 1, 2, ... (c2)

x(0) = x0 (2.3)

Page 45: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 41

แบบฝกหด พมพ1.

g(x, y) =xy + x + y−2

(1 + f(x,y)xy+x+y+2ewf )2

2.

d(x, y) ≤ d(x, z) + d(z, y)

A(α) =

∫ α

0t−γ(tI + A)−1dt , 0 < γ < 1. (d1)

||a− b|| ≤ ||a + c||+ ||c + b||≤ ǫ(1 + c). (a2)

K(x, y) = 1 +f(x, y)

xy + x + y + 2ewf(b1)

2.5 เมตรกส (Matrix)ในการพมพ Metrix เราตองใช package: amsmath (\usedpackageamsmath)รปแบบคำสงของ Metrix โดยทวไปมดงตอไปน

\begin****

...

...

\end****

โดยท **** เปนไปไดคอ matrix, pmatrix, bmatrix, vmatrix, Vmatrix

ตวอยาง\beginmatrix 0 & 1 \\1 & 0 \endmatrix\beginpmatrix 0 & 1 \\1 & 0 \endpmatrix\beginbmatrix 0 & 1 \\1 & 0 \endbmatrix\beginvmatrix 0 & 1 \\1 & 0 \endvmatrix\beginVmatrix 0 & 1 \\1 & 0 \endVmatrix

ผลทไดคอ0 1

1 0

(

0 1

1 0

) [

0 1

1 0

] ∣∣∣∣∣

0 1

1 0

∣∣∣∣∣

∥∥∥∥∥

0 1

1 0

∥∥∥∥∥

แบบฝกหด พมพ Metrix ตอไปน1. (

a + b + c uv

a + b u + v

)

2.

a + b + c uv · · · 27

a + b u + v · · · 52... ... . . . ...

b + c u− v · · · 23

Page 46: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

42 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

จากตวอยางขางตนเราม Matrix(

a + b + c uv

a + b c + d

)

ซงใชคำสง

$\beginpmatrixa+b+c & uv \\a+b & c+d

\endpmatrix$ในบางครงเราอาจจะตองการพพม Matrix ใหอยภายในบรรทด เชน

(a+b+c uva+b c+d

)เราใชคำสง

$\left( \beginsmallmatrixa+b+c & uv \\a+b & c+d

\endsmallmatrix \right)$

2.6 ตาราง (Table)รปแบบในการสรางตารางคอ\begintabular[pos]

...\endtabular

หลกของการพมพคำสงสรางตาราง1. pos เปนคำสงทบอกถงการจดรปแบบของแตละ column คอ r:= ชอดานขวา, l:= ชอดานซาย, c:=

ตรงกลาง และ | แทนเสนตงของตาราง เชน |r|l|c|2. ขอความของแตละ cell จะถกคนดวย & และคนระหวางแถวดวย \\3. คำสง \hline แทนเสนแนวนอนตวอยาง พจารณา

\begincenter\begintabular|l |r |r |r |\hline

Name & 1 & 2 & 3 \\ \hlinePeter &2.45&34.12&1.00 \\ \hlineJohn&2.00&12.86&3.17\\ \hlineDavid&6.32&1.85&0.71\\ \hline

\endtabular\endcenter

จะปรากฎผลดงน

Name 1 2 3Peter 2.45 34.12 1.00John 2.00 12.86 3.17David 6.32 1.85 0.71

Page 47: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 43

นอกจากนเราสามารถกำหนดขอความกำกบตาราง (Caption) ตำแหนงของตารางในหนากระดาษ และ การอางอง(Reference,Label) ไดดวยคำสงตอไปน

\begintable[h]([b],[t])\begintabular

\endtabular\captiontable-name\labellabel-name\endtable

โดยท 1. h, b, t คอการกำหนดตำแหนงตารางใหอยทปจจบน, ดานลางและดานบนของกระดาษ2. \caption คอ การกำหนดขอความกำกบตาราง3. \label คอ การกำหนดชอในอางอง

ตวอยาง พจารณา

Name Month Week AmountPeter Jan. 1 1.00

2 12.783 0.714 15.00

Total 29.49John Jan. 1 12.01

2 3.103 10.104 0.00

Total 25.21Grand Total 54.70

ตารางท 2.1: multicolumn cline

Page 48: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

44 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

พมพโดยคำสงดงน\begintable\begincenter\begintabular|cc|c|r|\hline

Name & Month & Week & Amount \\ \hlinePeter& Jan. & 1 & 1.00 \\ \cline3-4

& & 2 & 12.78 \\ \cline3-4& & 3 & 0.71 \\ \cline3-4& & 4 & 15.00 \\ \cline2-4& \multicolumn2|lTotal&29.49\\ \hline

John & Jan. & 1 & 12.01 \\ \cline3-4& & 2 & 3.10 \\ \cline3-4& & 3 & 10.10 \\ \cline3-4& & 4 & 0.00 \\ \cline2-4& \multicolumn2|lTotal&25.21\\ \hline

\multicolumn3|lGrand Total&54.70\\ \hline\endtabular\captionmulticolumn cline .\endcenter\endtable

หมายเหต1. \clinecoli-colj วาดเสนตรงแนวนอน ตงแต column ท i ถง column ท j2. \multicolumnnformattext เปนการรวม cell ตงแต cell น (ตำแหนง cell ปจจบน) เปนตนไป

จำนวน n cell ตามแถว และแสดงขอความ text ในรปแแบบของ format ทกำหนด

Page 49: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 45

แบบฝกหด ใหสรางตารางตอไปน1.

Name Month 2 3Peter 2.45 34.12 2.45Jhon absentDavid 6.32 1.85 0.71

ตารางท 2.2: Table1

2.

\beginequation \beginalign. .. or .. .\endequation \endalign

Page 50: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

46 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

2.7 แผนผง (Diagram)การเขยนแผนผง (Diagram) นนเราตองใช package: pb-diagram (\usedpackage pb-diagram)

ซงมโครงสรางของคำสง ดงน

\begindiagram\NODE \ARROW \ARROW ... \NODE \ARROW \ARROW... ...\\\NODE \ARROW \ARROW ... \NODE \ARROW \ARROW... ...\\\NODE \ARROW \ARROW ... \NODE \ARROW \ARROW... ...\\\enddiagram

เมอ NODE คอ ขอความทตองการใสในแผนผง

การเขยนลกศร (Arrow) สามารถกำหนดไดดวยคำสงตอไปน\arrow[size]direction,options\arrow[size]direction,onelabel,optionslabel\arrow[size]direction,twolabel,optionslabel1label2

โดยท 1. size คอการกำหนดขนาดของลกศรวาใหมขนาดเปนกเทาของมาตรฐาน เชน เมอเราพมพคำสง\arrow[2]s ลกศรจะมขนาดเปน 2 เทาของขนาดปกต

2. direction คอการบอกทศทางของลกศร โดยจะมคำสงตอไปนn, e, w, s, ne, nw, nne, nnw, sse, ssw, ene, ese, wnw, wsw, . . .

3. onelabel (การระบ 1 ตำแหนง) สามารถเลอกใชคำสงในการระบ label ไดดวยคำสงตอไปนt: ดานบนb: ดานลางl: ดานซาย (ใชเฉพาะลกศรแนวตงเทานน)r: ดานขวา (ใชเฉพาะลกศรแนวตงเทานน)

4. twolabel ( การระบ 2 ตำแหนง ) สามารถเลอกใชคำสงในการระบ label ไดดวยคำสงตอไปนtb: ดานบนและดานลางlr: ดานซายและดานขวา (ใชเฉพาะลกศรแนวตงเทานน)

5. option คอการบอกลกษณะของลกศร และ ตำแหนงของ label เชน5.1 ลกษณะของหวลกศร

- ไมมหวลกศร<> มหวลกศรทงสองดาน

5.2 การบอกตำแหนงของ label1 การวาง label ในตำแหนง 1 ใน 4 ของความยาวทวดจากหางหวลกศร2 การวาง label ในตำแหนง 2 ใน 4 ของความยาวทวดจากหางหวลกศร3 การวาง label ในตำแหนง 3 ใน 4 ของความยาวทวดจากหางหวลกศร

หมายเหต การพมพคำสงนนจะตองไมมชองวางในคำสง

นอกจากนเราสามารถกำหนดอตราสวนอนได เชน ตองการใหตำแหนงของ label อยท 5/6 จากหวลกศรสามารถทำไดดวยคำสงตอไปน

ตวอยาง

Page 51: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 47

-f

คำสงทใชตอไปน\dgARROWPARTS=6\begindiagram\arrowe,t,5f\enddiagram

ตวอยาง หากตองผลดงภาพ

M0 M1 M2 · · · Mn-f1 -f2 -f3 -fn

คำสงทใช\[ \begindiagram\nodeM 0\arrowe,tf 1\nodeM 1\arrowe,tf 2\nodeM 2\arrowe,tf 3\node\cdots\arrowe,tf n\nodeM n\enddiagram \]

ตวอยาง หากตองผลดงภาพ

M N P Q

M ′ N ′ P ′ Q′

-f

?

α

-g

?

β

-h

?

γ

-f ′

-g′ -h′

Page 52: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

48 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

คำสง

\[

\begindiagram

\nodeM \arrowe,tf

\arrows,r\alpha

\nodeN \arrowe,tg

\arrows,r\beta

\nodeP \arrowe,th

\arrows,r\gamma

\nodeQ \arrows,r\delta\\

\nodeM’ \arrowe,tf’

\nodeN’ \arrowe,tg’

\nodeP’ \arrowe,th’

\nodeQ’

\enddiagram

\]

แบบฝกหด สราง Diagram ตอปน1.

A B C

D EE F

G H I

6

@@

@@I

-

?

@@

@@R@@

@@I

2.L3

M0 M1 M2

L1 L2

?

α

-f1

-f2

?

β

3.D

A B C

E I X?τ

@@

@@Rσ

@@

@@I ς

Page 53: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 49

2.8 Theorem and Proofในหวขอน เราจะพดถงการพมพทฤษฎบท บทแทรก บทนยาม บทพสจน ฯลฯ

ซงเราจำเปนตองใช package เพมเตม คอ amsthm

โดยมรปแบบของคำสง ดงน

\beginenv-name[Name]\labellabel-name. . . stats of theorem . . .

\beginproof...\endproof\endenv-name

หมายเหต โปรแกรม LATEX จะเรยงลำดบหมายเลขใหโดยอตโนมต

การทเราจะใชคำสง \beginenv-name ไดนน เราจำเปนตองมการประกาศการใชงาน env-name ไว โดยจะอยระหวาง\documentclass???? กบ \begindocument ซงการประกาศมได 3 รปแบบคอ

รปแบบท 1: \newtheoremenv-nameFullname

รปแบบท 2: \newtheoremenv-nameFullname[secCounter]

รปแบบท 3: \newtheoremenv-name[procCounter]Fullname

โดยท

• env-name คอ ชอทตองการเรยกใช

• Fullname คอ ขอความเตมทใชแสดง

• [secCounte] (ในรปแบบท 2) เปนการระบถงลำดบหมายเลขของ env-name วาขนอยกบ secCounte

หรอไม พรอมแสดงลำดบของ secCounte ดวย (secCounte เชน section subsection etc)

• [procCounter] (ในรปแบบท 3) เปนระบถงลำดบหมายเลขของ env-name โดยใหนบลำดบหมายเลขตอจากprocCounter

Page 54: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

50 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

env-name ทนยมใชกน คอ

env-name Fullname

Def Definition

Lem Lemma

Pro Proposition

Thm Theorem

Cor Corollary

Rem Remark

Exm Example

หมายเหต: ในบางทชอยอทเราตงเปนคำสงใน LATEX อย เรากไมสามารถทจะตงใชงานได

ตวอยาง

\newtheoremThmTheorem

\newtheoremDefDefinition

\newtheoremLemLemma

การเรยกใช

\beginThm

The sum of the angles

of a triangles is 180$^\circ$.

\endThm

Theorem 1. The sum of the an-gles of a triangles is 180.

\beginDef

The sum of the angles

of a triangles is 180$^\circ$.

\endDef

Definition 1. The sum of the an-gles of a triangles is 180.

\beginLem

The sum of the angles

of a triangles is 180$^\circ$.

\endLem

Lemma 1. The sum of the anglesof a triangles is 180.

ตวอยาง

\newtheoremThmTheorem[section]

\newtheoremDefDefinition[section]

\newtheoremLemLemma[section]

ตวอยาง

\newtheoremThmTheorem

\newtheoremDef[Thm]Definition

\newtheoremLem[Thm]Lemma

Page 55: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 51

รปแบบการพมพของ Theorem (Style)

คำสงทใชกำหนดรปแบบของ Theorem (Style) คอ

\theoremstylestyle

ตำแหนงทอย: อยระหวาง \documentclass???? กบ \begindocument กอน การประกาศ \newtheorem

รปแบบ (Style) มดวยกน 3 แบบ ดงน

STYLE FORMATplain name and number in boldface and body in italicdefinition name and number in boldface and body in romanremark name and number in italic and body in roman

Page 56: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

52 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

ตวอยาง การใช \newtheoremenv-nameFullname\documentclassarticle\theoremstyleplain\newtheoremDefDefinition\newtheoremThmTheorem\newtheoremLemLemma\begindocument\beginDef This is Definition1. \endDef\beginThmThis is Theorem1.

\beginproofThis is a proof of theorem1.

\endproof \endThm\beginThm This is Theorem2.

\beginproofThis is a proof of theorem2.

\endproof \endThm\beginThm This is Theorem3. \endThm\beginDef This is Definition2. \endDef\beginLem This is Lemma1. \endLem\beginLem This is Lemma2. \endLem\beginDef This is Definition3. \endDef\enddocument

ผลลพธคอ

Definition 1. This is Definition 1. .

Theorem 1. This is Theorem1.

พสจน. This is a proof of theorem 1. .

Theorem 2. This is Theorem2.

พสจน. This is a proof of theorem 2. .

Theorem 3. This is Theorem3.

Definition 2. This is Definition 2. .

Lemma 1. This is Lemma1.

Lemma 2. This is Lemma2.

Definition 3. This is Definition 3. .

Page 57: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 53

ตวอยาง เปลยนสวนกำหนดรปแบบของ theoremstyle ของตวอยางท 1 เปน\documentclassarticle\theoremstyleplain\newtheoremDefDefinition\newtheoremThm[Def]Theorem\newtheoremLem[Def]Lemma\begindocument

ผลลพธคอ

Definition 1. This is Definition 1. .

Theorem 2. This is Theorem2.

พสจน. This is a proof of theorem 2. .

Theorem 3. This is Theorem3.

พสจน. This is a proof of theorem 3. .

Theorem 4. This is Theorem4.

Definition 5. This is Definition 5. .

Lemma 6. This is Lemma6.

Lemma 7. This is Lemma7.

Definition 8. This is Definition 8. .

Page 58: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

54 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

ตวอยาง กำหนดตวเลข Theorem, Lemma ใหเรยงตามกน\documentclassarticle\theoremstyleplain\newtheoremDefDefinition\newtheoremThmTheorem\newtheoremLem[Thm]Lemma\begindocument

ผลลพธคอ

Definition 1. This is Definition 1. .

Theorem 1. This is Theorem1.

พสจน. This is a proof of theorem 1. .

Theorem 2. This is Theorem2.

พสจน. This is a proof of theorem 2. .

Theorem 3. This is Theorem3.

Definition 2. This is Definition 2. .

Lemma 4. This is Lemma4.

Lemma 5. This is Lemma5.

Definition 3. This is Definition 3. .

Page 59: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 55

ตวอยาง

\documentclassbook

\usepackageamsmath,amsthm,amssymb

\theoremstyleremark

\newtheoremThmTheorem

\newtheoremDefDefinition[section]

\newtheoremLem[Def]Lemma

\begindocument

\chapterONE

\sectionFirst

\beginThm dcdsf \endThm

\beginDef defdef \endDef

\beginLem lemlem \endLem

\beginThm dcdsf2 \endThm

\beginDef defdef2 \endDef

\beginLem lemlem2 \endLem

\sectionSecond

\beginThm dcdsf \endThm

\beginDef defdef \endDef

\beginLem lemlem \endLem

\beginThm dcdsf2 \endThm

\beginDef defdef2 \endDef

\beginLem lemlem2 \endLem

\enddocument

Page 60: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

56 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

แบบฝกหด ลองพมพเอกสารดงน (พจารณาการเรยงของหมายเลขดวย)

Definition 1. A set is finite iff it is equinumerous to some natural number. Otherwise it is infinite.

Remark. Every natural number is a finite set.

Theorem 1. (Pigeonhole Principle)No natural number is equinumerous to a proper subset of itself.

Corollary 2. No finite set is equinumerous to a proper subset of itself.

พสจน. follow from Theorem 1.

Corollary 3.1. Ant set equinumerous to a proper subset of itself is infinite.2. The set ω is infinite.

Definition 2. For a finite set A, the unique n ∈ ω such that A ≈ n is called the cardinal number of A, denote bycard(A).

Lemma 4. Any finite set is equinumerous to a unique natural number.

Remark1. For any finite set A and B, card(A) = card(B) iff A ≈ B.2. Any natural number n is a cardinal number.

Lemma 5. If C is a proper subset of a natural number n, then C ≈ m for somem ∈ n.

Corollary 6. Any subset of a finite set is finite.

Proposition 3. Well-order set is very good.

Example 4. I can no found and you can not found.

Page 61: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

บทท 3

การจดรปแบบเอกสาาร

3.1 Sectionการกำหนด section ใน class book and class report ประกอบดวยคำสงซงเรยงลำดบกนดงตอไปน

• \chaptertext

• \sectiontext

• \subsectiontext

• \subsubsectiontext

• \paragraphtext

• \subparagraphtext

แตใน class article จะเรมตนลำดบหวขอดวย \sectiontext

หมายเหต คำสงทปรากฏขางตนนนจะกำหนดหมายเลขใหโดยอตโนมต แตหากตองการแบงเอกสารเปนสวนตางๆโดยไมกำหนดหมายเลข จะตองใชคำสง

• \chapter∗text

• \section∗text

• \subsection∗text

• \subsubsection∗text

• \paragraph∗text

• \subparagraph∗text

57

Page 62: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

58 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

3.2 การจดการขอมล

คำสงยอหนามคำสงดงตอไปน

\indent\noindent ไมยอหนา

คำสงขนบรรทดใหมมคำสงดงตอไปน

\\\newline = \\\indentEnter = Enter Enter = Enter Enter Enter = \\\indent

คำสงขนหนาใหมมคำสงดงตอไปน

\newpage\clearpage

การสรางกลองขอความมคำสงดงตอไปน1. การสรางกลองขอความแบบมกรอบ

คำสงท 1: \fbox textคำสงท 2: \framebox[width][pos]text

โดยท width คอ ความกวางของกลองขอความ ซงตองระบหนวยทใช เชน cm, pt, mm เปนตนpos คอ ตำแหนงของขอความ โดยจะมคำสงคอ

l: ชดซาย และ r: ชดขวา

โดยปกตถาเราไมกำหนดคาของ pos โปรแกรมจะจดใหขอความอยตรงกลางของกลองขอความเสมอตวอยาง คำสง\fboxmathematics\framebox[3cm]mathematics\framebox[3cm][r]mathematicsผลลพธ

mathematicsmathematicsmathematics

2. การสรางกลองขอความแบบไมมกรอบคำสงท 1: \mboxtextคำสงท 2: \makebox[width][pos]text

Page 63: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 59

การพมพประโยคคำพดเราใชคำสง \lq...\rq และ \lq\lq ...\rq\rqผลลพธ

‘...’ และ “...”

การเวนทวางแนวนอนคำสงทใชคอ \hspacelengthเมอ length คอ ความกวางของชองวางซงตองระบหนวยทใช เชน cm, pt เปนตน

การเวนทวางแนวตงคำสงทใชคอ \vspacelengthเมอ length คอ ความกวางของชองวางซงตองระบหนวยทใช เชน cm, pt เปนตน

การจดขอความใหอยกลางหนากระดาษคำสงคอ \begincenter หรอ \centering และมรปแบบคอ\begincenter..\endcenter

การจดขอความใหอยชดซายของกระดาษคำสงคอ \beginflushleft มรปแบบคอ\beginflushleft..\endflushleft

การจดขอความใหอยชดขวาของกระดาษคำสงคอ \beginflushrigh มรปแบบคอ\beginflushrigh..\endflushrigh

Page 64: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

60 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

การเปลยนขนาดตวอกษร ตวอกษรม 10 ขนาด ดงน:

tiny \tiny Hello Hello

scriptsize \scriptsize Hello Hello

footnotesize \footnotesize Hello Hellosmall \small Hello Hellonormalsize \normalsize Hello Hellolarge \large Hello HelloLarge \Large Hello HelloLARGE \LARGE Hello Hellohuge \huge Hello HelloHuge \Huge Hello Hello

การเปลยนรปแบบตวอกษร ตวอกษรมรปแบบตาง ๆ ดงน:Commanded1 Commaned2 Result\normalfront We are happy \textnormal We are happy We are happy\it We are happy \textit We are happy We are happy\rm We are happy \textrm We are happy We are happy\sf We are happy \textsf We are happy We are happy\tt We are happy \texttt We are happy We are happy

\upshape We are happy We are happy\sl We are happy \textsl We are happy We are happy\bf We are happy \textbf We are happy We are happy

3.3 Item การพมพรายการ3.3.1 การพมพรายการทระบหมายเลข

มรปแบบคำสงดน\beginenumerate

\item...\item...

\endenumerateตวอยาง คำสง\beginenumerate

\item The labels consist of sequential numbers.

\item The numbering starts at 1 with every call to the

enumerate environment.

\endenumerate

ผลลพธ

1. The labels consist of sequential numbers.

2. The numbering starts at 1 with every call to the enumerate environment.

Page 65: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 61

3.3.2 การพมพรายการทไมระบหมายเลข

มรปแบบคำสงดวน\beginitemize

\item...\item...

\enditemizeตวอยาง คำสง\beginitemize

\item The individual entries are indicated with a black dot,

a so-called bullet, as a label.

\item The text in the entries may be of any length. The label

appears at the beginning of first line of text.

\item Successive entries are separated from one another by

additional vertical spacing.

\enditemize

ผลลพธ

• The individual entries are indicated with a black dot, a so-called bullet, as a label.

• The text in the entries may be of any length. The label appears at the beginning of first line of text.

• Successive entries are separated from one another by additional vertical spacing.

3.3.3 การพมพรายการทระบคำอธบาย

มรปแบบคำสงดวน\begindescription\ item[item1].....

\ item[item2].....

\enddescription

ตวอยาง คำสง\begindescription

\item[case1. ] This environment is appropriate when a number

of words or expressions are to be defined.

\item[case2. ] A keyword is used as the lablel and the entry

contains a clarification or explanation.

\enddescription

ผลลพธ

case1. This environment is appropriate when a number of words or expressions are to be defined.

case2. A keyword is used as the lablel and the entry contains a clarification or explanation.

Page 66: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

62 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

3.4 Formal page คำสงจดหนากระดาษ3.4.1 documentclassคำสง \documentclass[option]class เปนคำสงกำหนดรปแบบโดยรวมของเอกสารของเรา เชน

\documentclass[11pt, twoside,a4paper]article

โดย class มคำสงพนฐานดงนarticle ใชสำหรบเปน article ใน journals, presentation, shot repoatrs, . . .report ใชสำหรบ small book, PhD thesisbook สำหรบการพมพทำหนงสอslides คลาย ๆ power point ของ microsoft office

ในสวนของ option สามารถพมพสลบกนได เชน [twoside, 11pt, a4paper] มคำสงดงน

11 pt ขนาดของตวอกษรปกต (\textnormal)สามารถเลอกได 3 ขนาดคอ 10pt, 11pt, 12pt

หากไมใสคาจะเปน 10 pt

twoside, oneside สำหรบใน class article กบ report จะมแคหนาเดยวa4paper,latterpaper ระบขนาดของกระดาษ โดยคาตงตนเปน latterpaper

นอกจากนยงม a4paper, a5paper, b5paper,

executivepaper, legalpaper

onecolumn, twocolumn ให LATEX พมพเอกสารเปน 1 column หรอ2 column

fleqn แสดงสตร หรอ สมการใหชดดานซายแทนการแสดงตรงกลางleqno ใสลำดบของสตรทขางซายแทนขางขวาtitlepage, nottitlepage ระบวาหนาใหมควรจะเรมหลงหวขอของเอกสารหรอไมซง

article class จะไมเรมหนาใหมดวย default ในขณะท reportและ book มการเรมหนาใหม

landscape เปลยน layout ของเอกสารใหเปนแบบแนวนอนopenright, openany ใหเรม chapter เฉพาะหนาขวาหรอใหเรมหนาถดไป

คำสงนไมสามารถใชใน article class เพราะใน article classไมม chapters

Page 67: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 63

คำสง \usedpackage [option]package เปนคำสงในการเรยกใช package เสรมตางๆ ทตองการเพมเตมเชน\usepackage[thai]babel\usepackageansThm,pb diagram

3.4.2 Paper formเปนคำสงทประกาศระหวาง \documentclass???? กบ \begindocument ซงมคำสงดงน:

\oddsidemargin การกำหนดขอบซายหนาค\evensidemargin การกำหนดขอบซายหนาค\topmargin การกำหนดขอบดานบน\headheight การกำหนดความสงของขอความหวกระดาษ\headset การกำหนดระยะหางจากดานลางสดถงสวนบนสดของเนอหา\textheight การกำหนดความสงของเนอหา\textwight การกำหนดความกวางของเนอหา\foorskip การกำหนดระยะหางจากฐานของสวนเนอหาถงสวนเนอหาของ foot note\columnsep การกำหนดความกวางของทวางระหวาง colume\headsep การกำหนดระยะหางระหวางสวนหวกระดาษกบสวนเนอหา

รปแบบการเขยน\documentclassbook\oddsidemargin 1cm

\setlength\evensidemargin-1 cm (สามารถใสคาเปนลบกได )

\begindocument

Page 68: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

6.4 Page Layout 111

Header

Body

Footer

MarginNotes

i8 -

i7

?

6

i1 -

-i3 i10 -

- i9

6

?

i11

i2?

6i46

?

i56

?

i6

6

?

1 one inch + \hoffset 2 one inch + \voffset3 \oddsidemargin = 22pt 4 \topmargin = 22pt

or \evensidemargin5 \headheight = 13pt 6 \headsep = 19pt7 \textheight = 595pt 8 \textwidth = 360pt9 \marginparsep = 7pt 10 \marginparwidth = 106pt

11 \footskip = 27pt \marginparpush = 5pt (not shown)\hoffset = 0pt \voffset = 0pt\paperwidth = 597pt \paperheight = 845pt

Figure 6.2: Page Layout Parameters.

Panat
Rectangle
Panat
Rectangle
Panat
Rectangle
Page 69: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

64 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

3.4.3 คำสงกำหนดขอความสวนหวกระดาษ (Heading paper)คำสง \pagestyle เปนคำสงทมรปแบบเขยนดงน:

\documentclassbook\pagestylestyle\markboth \begindocument

คำสง \thispagestylestyle จะเขยนอยสวนไหนกไดของหนานน

ตวอยางคำสงของ styleempty ไมมขอความสวนหวกระดาษและสวนทายกระดาษheadings มขอความสวนหวกระดาษแตไมมสวนทายกระดาษmyheadings คลายคำสง heading แตกำหนดขอความเองได\@evenhead สำหรบกระดาษทพมพสองดาน เพอกำหนดหวกระดาษของหนาค\@oddhead สำหรบกระดาษทพมพสองดาน เพอกำหนดหวกระดาษของหนาค\@evenfoot สำหรบกระดาษทพมพสองดาน เพอกำหนดทายกระดาษของหนาค\@oddfoot สำหรบกระดาษทพมพสองดาน เพอกำหนดทายกระดาษของหนาค

ตวอยาง คำสง\documentclassbook\pagestylemyheadings\markbothการอบรม LATEXขนพนฐานฉบบปรบปรง ป 2553\begindocument

ผลลพธ หวกระดาษหนงสอเลมน

การอบรม LATEXขนพนฐาน หวกระดาษหนาคฉบบปรบปรง ป 2553 หวกระดาษหนาค

3.4.4 คำสงกำหนดขอความสวนทายกระดาษ (Foot note )พมพคำสงหลงคำทตองการโดยรปแบบคำสงในการพมพ

\footnote foot note

ตวอยาง ลองพมพดLet $X$ be a metric space. Then a closed subset $A$\footnotethe complement

of a open set of $X$ is a $Gδ$-set\footnotea countable collection of openset.

ผลลพธLet X be a metric space. Then a closed subset A1 of X is a Gδ-set2. และดทายหนงสอหนานแบบฝกหด ลองพมพหนาปก

1the complement of a open set2a countable collection of openset

Page 70: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

ภาควชาคณตศาสตร คณะวทยาศาสตร มหาวทยาลยเชยงใหม 65

3.5 Referenceการพมพบรรณานกรม ลกษณะของบรรณานกรมจะอยสวนทายของหนงสอและขนหนาใหมโดยอตโนมตเสมอ มรปแบบคำสงคอ\beginthebibliographynumber\bibitem[lable1]key1..\bibitem[lable2]key2..\endthebibliographyเมอ number คอ จำนวนของเอกสารอางอง และ key คอ reference keyword

ตงอยาง คำสง\beginthebibliography99\bibitemlamport Leslie Lamport. \textsl\LaTeX\- A Document

Preparation System. Addison-Wesley Co., Inc.,Reading, MA, 1985

\bibitemKnuth Donald E. Knuth. \textslComputers and Typesetting

Vol.\A-E. Addison-Wesley Co., Inc.,Reading, MA, 1984-1986

\bibitem[2a]Knuth:a Vol A: \textslThe \TeX book, 1984

\bibitem[2b]Knuth:b Vol B: \textsl\TeX: The Program., 1986

\endthebibliographyผลลพธ

Page 71: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

66 การอบรมการสรางเอกสารทางวชาการดวยโปรแกรมภาษา LATEX

Page 72: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

บรรณานกรม

[1] Leslie Lamport. LATEX A Document Preparation System. Addison-Wesley Co., Inc.,Reading, MA, 1985

[2] Donald E. Knuth. Computers and Typesetting Vol. A-E. Addison-Wesley Co., Inc.,Reading, MA, 1984-1986

[2a] Vol A: The TEXbook, 1984

[2b] Vol B: TEX : The Program., 1986

ภายในเนอหา หากตองการอางถง Reference เราสามารถใชคำสง \citekey

Page 73: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Including Graphics in LATEX

Marko Boon

14th March 2005

1 Including external graphics

EPS PDF JPG GIF PNGLATEX yes no yes∗ no yes∗

PDFLATEX no yes yes no yes

Please note: only EPS and PDF are scalable. Use JPG and PNG for pho-tographs only!

Many programs can generate EPS directly. You can use Micrografx/CorelDesigner to export (almost?) everything to EPS format. Just Copy/Pasteobjects in Designer and export to ”EPS no header or preview”.

Use EPS2PDF (installed on your Windows desktop) to convert EPS to PDF.

∗ does not work automatically when working with LATEX. You should enterthe coordinates of the bounding box manually.

Including graphics:

• In preamble:

\usepackagegraphicx

• Including the graphic file:

1

Page 74: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\includegraphics[width =0.7\ linewidth ] filename

Use the file name without extension! LATEX will take the EPS file, PDFLATEXwill take the PDF file automatically.

2 The includegraphics command

\includegraphics[options ] filename

When including EPS or PDF files, use the file name without extension!LATEX will take the EPS, PDFLATEX will take the PDF.

Supported options are:

scale=number magnifies the figure by number over its natural size.

width=length specifies the width to which the figure should be scaled

height=length specifies the height to which the figure should be scaled

angle=number rotates the figure counterclockwise over the specified angle(in degrees)

bb=llx lly urx ury enters the coordinates of the bounding box manually.

3 Floating Figures

Use a figure environment to create floating figures. LATEX will position theimage on the place that you specify, or on the top of the next page if itdoesn’t fit on the current page anymore. In a figure environment you canuse a caption to give a description of the figure, and a label to refer to theimage.

\beginfigure [ht]

\begincenter

\includegraphics[width=8cm] images/rsm

\captiona response surface .

2

Page 75: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\labelfig:surface

\endcenter

\endfigure

Now you can refer to the image:

See figure \reffig:figure .

Please note:

The external figures will be embedded in the PostScript and PDF file, butnot in the DVI file!

4 Inline floats

The package wrapfig makes it possible to place text next to floats:

\beginwrapfigure placement [ overhang ]width

\includegraphics[width=\ linewidth ]image

\endwrapfigure

placement horizontal placement: l (left) or r (right). For two-sided docu-ments: i (inside edge) or o (outside edge).

overhang overhang of the float into the margin (default: 0pt).

width width of the figure or table (use wraptable for tables).

5 Two floats next to each other

5.1 No caption

\includegraphics[width =0.45\ linewidth ]pic1

\hfill

\includegraphics[width =0.45\ linewidth ]pic2

3

Page 76: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

5.2 One caption

\beginfigure [ht]

\includegraphics[width =0.45\ linewidth ]pic1

\hfill

\includegraphics[width =0.45\ linewidth ]pic2

\captiona response surface .

\labelfig:surface

\endfigure

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

Figure 1: a response surface.

4

Page 77: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

5.3 Two captions

Now we need the package caption. This package has very extensive function-ality to change the appearance of captions. In this case we are only going touse the new command \captionof.

\parbox[t]0.45\ textwidth

\includegraphics[width=\ linewidth ]pic1

\captionoffigure the first figure

\hfill

\parbox[t]0.45\ textwidth

\includegraphics[width=\ linewidth ]pic2

\captionoffigure the second figure

For tables, just repace figure by table.

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

Figure 2: the first figure

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

Figure 3: the second figure

5.4 Sub-captions

Now we need the package subfig:

\beginfigure [ht]

\begincenter

\subfloat[First figure ]

\includegraphics[width =0.45\ textwidth ]pic1

\subfloat[Second figure ]

5

Page 78: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\includegraphics[width =0.45\ textwidth ]pic2

\captionTwo figures

\endcenter

\endfigure

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

(a) First figure

1

2

3

4

5

Pressure

1

2

3

4

Temp

0

10

20

30

Response

1

2

3

4Pressure

0

10

20

30

(b) Second figure

Figure 4: Two figures

6

Page 79: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

color-package-demo.tex

Bent Petersen

Oct 24, 2000

The easiest way to use color text in LATEX2ε is to use the color package.You load the color package in your preamble as usual

\documentclass[11pt]article\usepackage[usenames]color

Here the option [usenames] causes the definitions for the 68 colors known todvips (see next page) to be preloaded. Those colors can then be specifiedby name. For example \colorBrickRed BrickRed produces BrickRed.Alternately one can use the command

\textcolorBrickRedthis is BrickRed

which produces this is BrickRed.

If the 68 predefined colors do not suffice, or if you do not want to load thedefinitions of all of them, you may define your own custom colors.

Here is a dark blue defined in terms of the RGB (red, green, blue) colormodel.

\definecolorMyDarkBluergb0,0.08,0.45\begincenter\colorMyDarkBlueThis color is MyDarkBlue\endcenter

This color is MyDarkBlue

Page 80: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Once we have defined the new color we can use it anywhere in the currentdocument. For example, \textcolorMyDarkBluea nice blue producesa nice blue.

Custom colors may also be defined in terms of the CMYK (cyan, magenta,yellow, black) color model. Here is a light magenta.

\definecolorMyLightMagentacmyk0.1,0.8,0,0.1\begincenter\colorMyLightMagentaThis color is MyLightMagenta\endcenter

This color is MyLightMagenta

The 68 standard colors known to dvips

Apricot Aquamarine Bittersweet BlackBlue BlueGreen BlueViolet BrickRedBrown BurntOrange CadetBlue CarnationPinkCerulean CornflowerBlue Cyan DandelionDarkOrchid Emerald ForestGreen FuchsiaGoldenrod Gray Green GreenYellowJungleGreen Lavender LimeGreen MagentaMahogany Maroon Melon MidnightBlueMulberry NavyBlue OliveGreen OrangeOrangeRed Orchid Peach PeriwinklePineGreen Plum ProcessBlue PurpleRawSienna Red RedOrange RedVioletRhodamine RoyalBlue RoyalPurple RubineRedSalmon SeaGreen Sepia SkyBlueSpringGreen Tan TealBlue ThistleTurquoise Violet VioletRed WhiteWildStrawberry Yellow YellowGreen YellowOrange

2

Page 81: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

LATEX Mathematical SymbolsThe more unusual symbols are not defined in base LATEX (NFSS) and require \usepackageamssymb

1 Greek and Hebrew letters

α \alpha κ \kappa ψ \psi z \digamma ∆ \Delta Θ \Thetaβ \beta λ \lambda ρ \rho ε \varepsilon Γ \Gamma Υ \Upsilonχ \chi µ \mu σ \sigma κ \varkappa Λ \Lambda Ξ \Xiδ \delta ν \nu τ \tau ϕ \varphi Ω \Omegaε \epsilon o o θ \theta $ \varpi Φ \Phi ℵ \alephη \eta ω \omega υ \upsilon % \varrho Π \Pi i \bethγ \gamma φ \phi ξ \xi ς \varsigma Ψ \Psi k \dalethι \iota π \pi ζ \zeta ϑ \vartheta Σ \Sigma ג \gimel

2 LATEX math constructsabcxyz \fracabcxyz abc \overlineabc

−→abc \overrightarrowabc

f ′ f’ abc \underlineabc←−abc \overleftarrowabc

√abc \sqrtabc abc \widehatabc

︷︸︸︷abc \overbraceabc

n√abc \sqrt[n]abc abc \widetildeabc abc︸︷︷︸ \underbraceabc

3 Delimiters| | \ b \lfloor / / ⇑ \Uparrow x \llcorner| \vert \ c \rfloor \ \backslash ↑ \uparrow y \lrcorner‖ \| 〈 \langle d \lceil [ [ ⇓ \Downarrow p \ulcorner‖ \Vert 〉 \rangle e \rceil ] ] ↓ \downarrow q \urcorner

Use the pair \lefts1 and \rights2 to match height of delimiters s1 and s2 to the height of their contents, e.g.,\left| expr \right| \left\ expr \right\ \left\Vert expr \right.

4 Variable-sized symbols (displayed formulae show larger version)∑\sum

∫\int

⊎\biguplus

⊕\bigoplus

∨\bigvee∏

\prod∮

\oint⋂

\bigcap⊗

\bigotimes∧

\bigwedge∐\coprod

∫∫\iint

⋃\bigcup

⊙\bigodot

⊔\bigsqcup

5 Standard Function Names

Function names should appear in Roman, not Italic, e.g., Correct: \tan(at-n\pi) −→ tan(at− nπ)Incorrect: tan(at-n\pi) −→ tan(at− nπ)

arccos \arccos arcsin \arcsin arctan \arctan arg \argcos \cos cosh \cosh cot \cot coth \cothcsc \csc deg \deg det \det dim \dimexp \exp gcd \gcd hom \hom inf \infker \ker lg \lg lim \lim lim inf \liminflim sup \limsup ln \ln log \log max \maxmin \min Pr \Pr sec \sec sin \sinsinh \sinh sup \sup tan \tan tanh \tanh

Page 82: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

6 Binary Operation/Relation Symbols

∗ \ast ± \pm ∩ \cap C \lhd? \star ∓ \mp ∪ \cup B \rhd· \cdot q \amalg ] \uplus / \triangleleft \circ \odot u \sqcap . \triangleright• \bullet \ominus t \sqcup E \unlhd© \bigcirc ⊕ \oplus ∧ \wedge D \unrhd \diamond \oslash ∨ \vee 5 \bigtriangledown× \times ⊗ \otimes † \dagger 4 \bigtriangleup÷ \div o \wr ‡ \ddagger \ \setminus \centerdot \Box Z \barwedge Y \veebar~ \circledast \boxplus f \curlywedge g \curlyvee \circledcirc \boxminus e \Cap d \Cup \circleddash \boxtimes ⊥ \bot > \topu \dotplus \boxdot ᵀ \intercal i \rightthreetimes> \divideontimes \square [ \doublebarwedge h \leftthreetimes

≡ \equiv ≤ \leq ≥ \geq ⊥ \perp∼= \cong ≺ \prec \succ | \mid6= \neq \preceq \succeq ‖ \parallel∼ \sim \ll \gg ./ \bowtie' \simeq ⊂ \subset ⊃ \supset on \Join≈ \approx ⊆ \subseteq ⊇ \supseteq n \ltimes \asymp @ \sqsubset A \sqsupset o \rtimes.= \doteq v \sqsubseteq w \sqsupseteq ^ \smile∝ \propto a \dashv ` \vdash _ \frown|= \models ∈ \in 3 \ni /∈ \notin

u \approxeq 5 \leqq = \geqq ≶ \lessgtr∼ \thicksim 6 \leqslant > \geqslant Q \lesseqgtr

v \backsim / \lessapprox ' \gtrapprox S \lesseqqgtr

w \backsimeq ≪ \lll ≫ \ggg T \gtreqqless

, \triangleq l \lessdot m \gtrdot R \gtreqless$ \circeq . \lesssim & \gtrsim ≷ \gtrlessl \bumpeq 0 \eqslantless 1 \eqslantgtr \backepsilonm \Bumpeq - \precsim % \succsim G \between+ \doteqdot w \precapprox v \succapprox t \pitchfork≈ \thickapprox b \Subset c \Supset p \shortmid; \fallingdotseq j \subseteqq k \supseteqq a \smallfrown: \risingdotseq @ \sqsubset A \sqsupset ` \smallsmile∝ \varpropto 4 \preccurlyeq < \succcurlyeq \Vdash∴ \therefore 2 \curlyeqprec 3 \curlyeqsucc \vDash∵ \because J \blacktriangleleft I \blacktriangleright \VvdashP \eqcirc E \trianglelefteq D \trianglerighteq q \shortparallel6= \neq C \vartriangleleft B \vartriangleright / \nshortparallel

\ncong \nleq \ngeq * \nsubseteq- \nmid \nleqq \ngeqq + \nsupseteq∦ \nparallel \nleqslant \ngeqslant " \nsubseteqq. \nshortmid ≮ \nless ≯ \ngtr # \nsupseteqq/ \nshortparallel ⊀ \nprec \nsucc ( \subsetneq \nsim \npreceq \nsucceq ) \supsetneq3 \nVDash \precnapprox \succnapprox $ \subsetneqq2 \nvDash \precnsim \succnsim % \supsetneqq0 \nvdash \lnapprox \gnapprox \varsubsetneq6 \ntriangleleft \lneq \gneq ! \varsupsetneq5 \ntrianglelefteq \lneqq \gneqq & \varsubsetneqq7 \ntriangleright \lnsim \gnsim ' \varsupsetneqq4 \ntrianglerighteq \lvertneqq \gvertneqq

Page 83: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

7 Arrow symbols← \leftarrow ←− \longleftarrow ↑ \uparrow⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow→ \rightarrow −→ \longrightarrow ↓ \downarrow⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow↔ \leftrightarrow ←→ \longleftrightarrow l \updownarrow⇔ \Leftrightarrow ⇐⇒ \Longleftrightarrow m \Updownarrow

7→ \mapsto 7−→ \longmapsto \nearrow← \hookleftarrow → \hookrightarrow \searrow \leftharpoonup \rightharpoonup \swarrow \leftharpoondown \rightharpoondown \nwarrow \rightleftharpoons \leadsto

99K \dashrightarrow L99 \dashleftarrow ⇔ \leftleftarrows \leftrightarrows W \Lleftarrow \twoheadleftarrow \leftarrowtail " \looparrowleft \leftrightharpoonsx \curvearrowleft \circlearrowleft \Lsh \upuparrows \upharpoonleft \downharpoonleft( \multimap ! \leftrightsquigarrow ⇒ \rightrightarrows \rightleftarrows ⇒ \rightrightarrows \rightleftarrows \twoheadrightarrow \rightarrowtail # \looparrowright \rightleftharpoons y \curvearrowright \circlearrowright \Rsh \downdownarrows \upharpoonright \downharpoonright \rightsquigarrow

8 \nleftarrow 9 \nrightarrow : \nLeftarrow; \nRightarrow = \nleftrightarrow < \nLeftrightarrow

8 Miscellaneous symbols∞ \infty ∀ \forall k \Bbbk ℘ \wp∇ \nabla ∃ \exists F \bigstar ∠ \angle∂ \partial @ \nexists \diagdown ] \measuredangleð \eth ∅ \emptyset \diagup ^ \sphericalangle♣ \clubsuit ∅ \varnothing ♦ \Diamond \complement♦ \diamondsuit ı \imath ` \Finv O \triangledown♥ \heartsuit \jmath a \Game 4 \triangle♠ \spadesuit ` \ell ~ \hbar M \vartriangle· · · \cdots

∫∫∫∫\iiiint \hslash \blacklozenge

... \vdots∫∫∫

\iiint ♦ \lozenge \blacksquare. . . \ldots

∫∫\iint f \mho N \blacktriangle

. . . \ddots ] \sharp ′ \prime H \blacktrinagledown= \Im [ \flat \square 8 \backprime< \Re \ \natural

√\surd s \circledS

9 Math mode accents

a \acutea a \bara ´A \Acute\AcuteA ¯A \Bar\BarA

a \brevea a \checka ˘A \Breve\BreveA ˇA \Check\CheckA

a \ddota a \dota ¨A \Ddot\DdotA ˙A \Dot\DotA

a \gravea a \hata `A \Grave\GraveA ˆ

A \Hat\HatA

a \tildea ~a \veca ˜A \Tilde\TildeA~~A \Vec\VecA

Page 84: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

10 Array environment, examples

Simplest version: \beginarraycols row1 \\ row2 \\ . . . rowm \endarraywhere cols includes one character [lrc] for each column (with optional characters | inserted for vertical lines)and rowj includes character & a total of (n− 1) times to separate the n elements in the row. Examples:

\left( \beginarraycc 2\tau & 7\phi-frac512 \\3\psi & \frac\pi8 \endarray \right)

\left( \beginarrayc x \\ y \endarray \right)\mbox~and~ \left[ \beginarraycc|r

3 & 4 & 5 \\ 1 & 3 & 729 \endarray \right]

(2τ 7φ− 5

123ψ π

8

) (xy

)and

[3 4 51 3 729

]

f(z) = \left\ \beginarrayrcl\overline\overlinez^2+\cos z & \mboxfor& |z|<3 \\ 0 & \mboxfor & 3\leq|z|\leq5 \\\sin\overlinez & \mboxfor & |z|>5

\endarray\right.

f(z) =

z2 + cos z for |z| < 30 for 3 ≤ |z| ≤ 5

sin z for |z| > 5

11 Other Styles (math mode only)

Caligraphic letters: $\mathcalA$ etc.: AB C D E F G HI J KLMN OP QRS T U V W X Y Z

Mathbb letters: $\mathbbA$ etc.: ABCDEFGHI JKLMNOPQRSTUVWXYZ

Mathfrak letters: $\mathfrakA$ etc.: AB CDE FG HI J K LM N O P Q RST UV W X YZ a b c 1 2 3

Math Sans serif letters: $\mathsfA$ etc.: AB CD E F GH I JK LMN O P QR STU V W XY Z a b c 1 2 3

Math bold letters: $\mathbfA$ etc.: ABCDEFGHIJKLMNOPQRSTUVWXY Z abc 123

Math bold italic letters: define \def\mathbi#1\textbf\em #1 then use $\mathbiA$ etc.:ABCDEFGHI JKLMNOPQRSTUVWXYZ a b c 1 2 3

12 Font sizes

Math Mode:

∫f−1(x− xa) dx $\displaystyle \int f^-1(x-x_a)\,dx$∫f−1(x− xa) dx $\textstyle \int f^-1(x-x_a)\,dx$∫

f−1(x−xa) dx $\scriptstyle \int f^-1(x-x_a)\,dx$∫f−1(x−xa) dx $\scriptscriptstyle \int f^-1(x-x_a)\,dx$

Text Mode:

\tiny = smallest

\scriptsize = very small

\footnotesize = smaller

\small = small

\normalsize = normal\large = large\Large = Large\LARGE = LARGE

\huge = huge\Huge = Huge

13 Text Mode: Accents and Symbols

o \’o o \"o o \^o o \‘o o \~o o \=o s. \d so \.o o \uo o \Ho oo \too o \co o. \do s \r so¯

\bo A \AA a \aa ß \ss ı \i \j s \H sø \o s \t s s \v s Ø \O ¶ \P § \Sæ \ae Æ \AE † \dag ‡ \ddag c© \copyright £ \pounds

Page 85: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX

Michael Downes

American Mathematical Society

Version 1.07 (2000/07/19)

1. Introduction This is a concise summary of recommended features in LATEX and acouple of extension packages for writing math formulas. Readers needing greater depth ofdetail are referred to the sources listed in the bibliography, especially [Lamport], [LaTeX-U],[AMUG], [LaTeX-F], [LaTeX-G], and [GMS]. A certain amount of familiarity with standardLATEX terminology is assumed; if your memory needs refreshing on the LATEX meaning ofcommand, optional argument, environment, package, and so forth, see [Lamport].

The features described here are available to you if you use LATEX with two extensionpackages published by the American Mathematical Society: amssymb and amsmath. Thus,the source file for this document begins with

\documentclassarticle\usepackageamssymb,amsmath

The amssymb package might be omissible for documents whose math symbol usage is rela-tively modest; the easiest way to test this is to leave out the amssymb reference and see ifany math symbols in the document stop working.

Many noteworthy features found in other packages are not covered here; see Section 9.

2. Inline math formulas and displayed equations

2.1. The fundamentals Entering and leaving math mode in LATEX is normally done withthe following commands and environments.

inline formulas displayed equations

$ . . . $\( . . . \)

\[...\] unnumbered

\beginequation*. . .\endequation*

unnumbered

\beginequation. . .\endequation

automaticallynumbered

Note. Alternative environments \beginmath . . . \endmath, \begindisplaymath . . . \enddisplaymathare seldom needed in practice. Using the plain TEX notation $$ . . . $$ for displayed equations is not rec-ommended. Even though it is not expressly forbidden in LATEX, it interferes with the proper operation ofvarious features such as the fleqn option.

Environments for handling equation groups and multi-line equations are shown in Table 1.

2.2. Automatic numbering and cross-referencing To get an auto-numbered equa-tion, use the equation environment; to assign a label for cross-referencing, use the \labelcommand:

\beginequation\labelreio...\endequation

1

Page 86: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 2

Table 1: Multi-line equations and equation groups (vertical lines indicating nominal mar-gins).\beginequation\labelxx\beginsplita& =b+c-d\\& \quad +e-f\\& =g+h\\& =i\endsplit\endequation

a = b+ c− d+ e− f

= g + h

= i

(2.1)

\beginmultlinea+b+c+d+e+f\\+i+j+k+l+m+n\endmultline

a+ b+ c+ d+ e+ f

+ i+ j + k + l +m+ n (2.2)

\begingathera_1=b_1+c_1\\a_2=b_2+c_2-d_2+e_2\endgather

a1 = b1 + c1 (2.3)a2 = b2 + c2 − d2 + e2 (2.4)

\beginaligna_1& =b_1+c_1\\a_2& =b_2+c_2-d_2+e_2\endalign

a1 = b1 + c1 (2.5)a2 = b2 + c2 − d2 + e2 (2.6)

\beginaligna_11& =b_11&a_12& =b_12\\

a_21& =b_21&a_22& =b_22+c_22

\endalign

a11 = b11 a12 = b12 (2.7)a21 = b21 a22 = b22 + c22 (2.8)

\beginflalign*a_11& =b_11&a_12& =b_12\\

a_21& =b_21&a_22& =b_22+c_22

\endflalign*

a11 = b11 a12 = b12

a21 = b21 a22 = b22 + c22

Note 1. The split environment is something of a special case. It is a subordinate environment that canbe used as the contents of an equation environment or the contents of one “line” in a multiple-equationstructure such as align or gather.

Note 2. The eqnarray and eqnarray* environments described in [Lamport] are not recommended becausethey produce inconsistent spacing of the equal signs and make no attempt to prevent overprinting of theequation body and equation number.

Page 87: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 3

To get a cross-reference to an auto-numbered equation, use the \eqref command:

... using equations \eqrefax1 and \eqrefbz2, wecan derive ...

The above example would produce something like

using equations (3.2) and (3.5), we can derive

In other words, \eqrefax1 is equivalent to (\refax1).To give your equation numbers the form m.n (section-number.equation-number), use

the \numberwithin command in the preamble of your document:

\numberwithinequationsection

For more details on custom numbering schemes see [Lamport, §6.3, §C.8.4].The subequations environment provides a convenient way to number equations in a

group with a subordinate numbering scheme. For example, supposing that the currentequation number is 2.1, write

\beginequation\labelfirsta=b+c\endequationsome intervening text\beginsubequations\labelgrp\beginaligna&=b+c\labelsecond\\d&=e+f+g\labelthird\\h&=i+j\labelfourth\endalign\endsubequations

to geta = b+ c (2.9)

some intervening text

a = b+ c (2.10a)d = e+ f + g (2.10b)h = i+ j (2.10c)

By putting a \label command immediately after \beginsubequations you can get areference to the parent number; \eqrefgrp from the above example would produce (2.10)while \eqrefsecond would produce (2.10a).

3. Math symbols and math fonts

3.1. Classes of math symbols The symbols in a math formula fall into different classesthat correspond more or less to the part of speech each symbol would have if the formulawere expressed in words. Certain spacing and positioning cues are traditionally used forthe different symbol classes to increase the readability of formulas.

Classnumber Mnemonic

Description(part of speech) Examples

0 Ord simple/ordinary (“noun”) A 0 Φ∞1 Op prefix operator

∑ ∏ ∫2 Bin binary operator (conjunction) + ∪ ∧3 Rel relation/comparison (verb) = < ⊂4 Open left/opening delimiter ( [ 〈5 Close right/closing delimiter ) ] 〉6 Pun postfix/punctuation . , ; !

Page 88: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 4

Note 1. The distinction in TEX between class 0 and an additional class 7 has to do only with font selectionissues and is immaterial here.

Note 2. Symbols of class Bin, notably the minus sign −, are automatically coerced to class 0 (no space) ifthey do not have a suitable left operand.

The spacing for a few symbols follows tradition instead of the general rule: although /is (semantically speaking) of class 2, we write k/2 with no space around the slash ratherthan k / 2. And compare p|q p|q (no space) with p\mid q p | q (class-3 spacing).

The proper way to define a new math symbol is discussed in LATEX2ε font selection[LaTeX-F]. It is not really possible to give a useful synopsis here because one needs first tounderstand the ramifications of font specifications.

3.2. Some symbols intentionally omitted here The following math symbols thatare mentioned in the LATEX book [Lamport] are intentionally omitted from this discussionbecause they are superseded by equivalent symbols when the amssymb package is loaded.If you are using the amssymb package anyway, the only thing that you are likely to gain byusing the alternate name is an unnecessary increase in the number of fonts used by yourdocument.

\Box, see \square \Diamond, see \lozenge ♦\leadsto, see \rightsquigarrow

\Join, see \bowtie ./\lhd, see \vartriangleleft C

\unlhd, see \trianglelefteq E\rhd, see \vartriangleright B

\unrhd, see \trianglerighteq D

3.3. Latin letters and Arabic numerals The Latin letters are simple symbols, class 0.The default font for them in math formulas is italic.

ABC DE F GH I J K LM N OP QRS T U V W X Y Za b c d e f g h i j k lmn o p q r s t u v w x y z

When adding an accent to an i or j in math, dotless variants can be obtained with \imathand \jmath:

ı \imath \jmath \hat\jmath

Arabic numerals 0–9 are also of class 0. Their default font is upright/roman.

0 1 2 3 4 5 6 7 8 9

3.4. Greek letters Like the Latin letters, the Greek letters are simple symbols, class 0.For obscure historical reasons, the default font for lowercase Greek letters in math formu-las is italic while the default font for capital Greek letters is upright/roman. (In otherfields such as physics and chemistry, however, the typographical traditions are somewhatdifferent.) The capital Greek letters not present in this list are the letters that have thesame appearance as some Latin letter: A for Alpha, B for Beta, and so on. In the list oflowercase letters there is no omicron because it would be identical in appearance to Latin o.In practice, the Greek letters that have Latin look-alikes are seldom used in math formulas,

Page 89: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 5

to avoid confusion.

Γ \Gamma∆ \DeltaΛ \LambdaΦ \PhiΠ \PiΨ \PsiΣ \SigmaΘ \ThetaΥ \UpsilonΞ \XiΩ \Omega

α \alphaβ \betaγ \gammaδ \deltaε \epsilonζ \zetaη \etaθ \thetaι \iotaκ \kappaλ \lambdaµ \muν \nu

ξ \xiπ \piρ \rhoσ \sigmaτ \tauυ \upsilonφ \phiχ \chiψ \psiω \omega

z \digammaε \varepsilonκ \varkappaϕ \varphi$ \varpi% \varrhoς \varsigmaϑ \vartheta

3.5. Other alphabetic symbols These are also class 0.

ℵ \alephi \bethk \dalethג \gimel

\complement` \ellð \eth~ \hbar

\hslashf \mho∂ \partial℘ \wp

s \circledSk \Bbbk` \Finva \Game

= \Im< \Re

3.6. Miscellaneous simple symbols These symbols are also of class 0 (ordinary) whichmeans they do not have any built-in spacing.

# \#& \&∠ \angle8 \backprimeF \bigstar \blacklozenge \blacksquareN \blacktriangleH \blacktriangledown⊥ \bot

♣ \clubsuit \diagdown \diagup♦ \diamondsuit∅ \emptyset∃ \exists[ \flat∀ \forall♥ \heartsuit∞ \infty

♦ \lozenge] \measuredangle∇ \nabla\ \natural¬ \neg@ \nexists′ \prime] \sharp♠ \spadesuit^ \sphericalangle

\square√\surd

> \top4 \triangleO \triangledown∅ \varnothing

Note 1. A common mistake in the use of the symbols and # is to try to make them serve as binaryoperators or relation symbols without using a properly defined math symbol command. If you merely usethe existing commands \square or \# the inter-symbol spacing will be incorrect because those commandsproduce a class-0 symbol.

Note 2. Synonyms: ¬ \lnot

Page 90: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 6

3.7. Binary operator symbols

∗ *+ +− -q \amalg∗ \astZ \barwedge© \bigcirc5 \bigtriangledown4 \bigtriangleup \boxdot \boxminus \boxplus \boxtimes• \bullet∩ \cape \Cap

· \cdot \centerdot \circ~ \circledast \circledcirc \circleddash∪ \cupd \Cupg \curlyveef \curlywedge† \dagger‡ \ddagger \diamond÷ \div> \divideontimesu \dotplus

[ \doublebarwedgem \gtrdotᵀ \intercalh \leftthreetimesl \lessdotn \ltimes∓ \mp \odot \ominus⊕ \oplus \oslash⊗ \otimes± \pmi \rightthreetimeso \rtimes\ \setminus

r \smallsetminusu \sqcapt \sqcup? \star× \times/ \triangleleft. \triangleright] \uplus∨ \veeY \veebar∧ \wedgeo \wr

Synonyms: ∧ \land, ∨ \lor, d \doublecup, e \doublecap

3.8. Relation symbols: < = > ∼ and variants

< <= => >≈ \approxu \approxeq \asympv \backsimw \backsimeql \bumpeqm \Bumpeq$ \circeq∼= \cong2 \curlyeqprec3 \curlyeqsucc.= \doteq+ \doteqdotP \eqcirch \eqsim1 \eqslantgtr

0 \eqslantless≡ \equiv; \fallingdotseq≥ \geq= \geqq> \geqslant \gg≫ \ggg \gnapprox \gneq \gneqq \gnsim' \gtrapprox

R \gtreqless

T \gtreqqless

≷ \gtrless& \gtrsim \gvertneqq≤ \leq

5 \leqq6 \leqslant/ \lessapprox

Q \lesseqgtr

S \lesseqqgtr

≶ \lessgtr. \lesssim \ll≪ \lll \lnapprox \lneq \lneqq \lnsim \lvertneqq \ncong6= \neq \ngeq

\ngeqq

\ngeqslant

≯ \ngtr \nleq

\nleqq

\nleqslant≮ \nless⊀ \nprec \npreceq \nsim \nsucc \nsucceq≺ \precw \precapprox4 \preccurlyeq \preceq \precnapprox \precneqq \precnsim- \precsim: \risingdotseq

∼ \sim' \simeq \succv \succapprox< \succcurlyeq \succeq \succnapprox \succneqq \succnsim% \succsim≈ \thickapprox∼ \thicksim

, \triangleq

Synonyms: 6= \ne, ≤ \le, ≥ \ge, + \Doteq, ≪ \llless, ≫ \gggtr

Page 91: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 7

3.9. Relation symbols: arrows See also Section 4.

\circlearrowleft \circlearrowrightx \curvearrowlefty \curvearrowright \downdownarrows \downharpoonleft \downharpoonright← \hookleftarrow→ \hookrightarrow← \leftarrow⇐ \Leftarrow \leftarrowtail \leftharpoondown \leftharpoonup⇔ \leftleftarrows↔ \leftrightarrow⇔ \Leftrightarrow \leftrightarrows \leftrightharpoons! \leftrightsquigarrow

W \Lleftarrow←− \longleftarrow⇐= \Longleftarrow←→ \longleftrightarrow⇐⇒ \Longleftrightarrow7−→ \longmapsto−→ \longrightarrow=⇒ \Longrightarrow" \looparrowleft# \looparrowright \Lsh7→ \mapsto( \multimap: \nLeftarrow< \nLeftrightarrow; \nRightarrow \nearrow8 \nleftarrow= \nleftrightarrow9 \nrightarrow

\nwarrow→ \rightarrow⇒ \Rightarrow \rightarrowtail \rightharpoondown \rightharpoonup \rightleftarrows \rightleftharpoons⇒ \rightrightarrows \rightsquigarrowV \Rrightarrow \Rsh \searrow \swarrow \twoheadleftarrow \twoheadrightarrow \upharpoonleft \upharpoonright \upuparrows

Synonyms: ← \gets, → \to, \restriction

3.10. Relation symbols: miscellaneous

\backepsilon∵ \becauseG \betweenJ \blacktriangleleftI \blacktriangleright./ \bowtiea \dashv_ \frown∈ \in| \mid|= \models3 \ni- \nmid/∈ \notin∦ \nparallel. \nshortmid/ \nshortparallel* \nsubseteq

" \nsubseteqq+ \nsupseteq# \nsupseteqq6 \ntriangleleft5 \ntrianglelefteq7 \ntriangleright4 \ntrianglerighteq0 \nvdash1 \nVdash2 \nvDash3 \nVDash‖ \parallel⊥ \perpt \pitchfork∝ \proptop \shortmidq \shortparallela \smallfrown

` \smallsmile^ \smile@ \sqsubsetv \sqsubseteqA \sqsupsetw \sqsupseteq⊂ \subsetb \Subset⊆ \subseteqj \subseteqq( \subsetneq$ \subsetneqq⊃ \supsetc \Supset⊇ \supseteqk \supseteqq) \supsetneq% \supsetneqq

∴ \thereforeE \trianglelefteqD \trianglerighteq∝ \varpropto \varsubsetneq& \varsubsetneqq! \varsupsetneq' \varsupsetneqqM \vartriangleC \vartriangleleftB \vartriangleright` \vdash \Vdash \vDash \Vvdash

Synonyms: 3 \owns

3.11. Cumulative (variable-size) operators∫\int∮\oint⋂\bigcap⋃\bigcup

⊙\bigodot⊕\bigoplus⊗\bigotimes⊔\bigsqcup

⊎\biguplus∨\bigvee∧\bigwedge∐\coprod

∏\prod

∫ \smallint∑\sum

Page 92: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 8

3.12. Punctuation

. ./ /| |, ,

; ;: \colon: :! !

? ?· · · \dotsb. . . \dotsc· · · \dotsi

· · · \dotsm. . . \dotso. . . \ddots

... \vdots

Note 1. The : by itself produces a colon with class-3 (relation) spacing. The command \colon producesspecial spacing for use in constructions such as f\colon A\to B f : A→ B.

Note 2. Although the commands \cdots and \ldots are frequently used, we recommend the more seman-tically oriented commands \dotsb \dotsc \dotsi \dotsm \dotso for most purposes (see 4.6).

3.13. Pairing delimiters (extensible) See Section 6 for more information.()( )[ ][ ]\lbrace \rbrace∣∣∣ ∣∣∣ \lvert \rvert

∥∥∥∥∥∥ \lVert \rVert⟨⟩\langle \rangle⌈ ⌉\lceil \rceil⌊ ⌋\lfloor \rfloor

\lgroup \rgroup \lmoustache \rmoustache

3.14. Nonpairing extensible symbols∣∣∣ \vert ∥∥∥ \Vert/

/∖

\backslash \arrowvert

www \Arrowvert \bracevert

Note 1. Using \vert, |, \Vert, or \| for paired delimiters is not recommended (see 6.2).

Synonyms: ‖ \|

3.15. Extensible vertical arrowsx \uparrow~ww \Uparrow

y \downarrowww \Downarrow

xy \updownarrow~w \Updownarrow

3.16. Accents

x \acutexx \gravexx \ddotxx \tildex

x \barxx \brevexx \checkxx \hatx

~x \vecxx \dotxx \ddotx...x \dddotx

xxx \widetildexxxxxx \widehatxxx

3.17. Named operators These operators are represented by a multiletter abbreviation.

arccos \arccosarcsin \arcsinarctan \arctan

arg \argcos \cos

cosh \coshcot \cot

coth \coth

csc \cscdeg \degdet \detdim \dimexp \expgcd \gcd

hom \hominf \inf

inj lim \injlimker \kerlg \lg

lim \limlim inf \liminflim sup \limsup

ln \lnlog \log

max \maxmin \minPr \Pr

proj lim \projlimsec \secsin \sin

sinh \sinhsup \sup

tan \tantanh \tanhlim−→ \varinjlim

lim←− \varprojlim

lim \varliminf

lim \varlimsup

To define additional named operators outside the above list, use the \DeclareMathOperatorcommand; for example, after

Page 93: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 9

\DeclareMathOperator\rankrank\DeclareMathOperator\esssupess\,sup

one could write

\rank(x) rank(x)\esssup(y,z) ess sup(y, z)

The star form \DeclareMathOperator* creates an operator that takes limits in a displayedformula like sup or max.

3.18. Math font switches Not all of the fonts necessary to support comprehensivemath font switching are commonly available in a typical LATEX setup. Here are the resultsof applying various font switches to a wide range of math symbols when the standard setof Computer Modern fonts is in use. It can be seen that the only symbols that respondcorrectly to all of the font switches are the uppercase Latin letters. In fact, nearly all mathsymbols apart from Latin letters remain unaffected by font switches; and although thelowercase Latin letters, capital Greek letters, and numerals do respond properly to somefont switches, they produce bizarre results for other font switches. (Use of alternative mathfont sets such as Lucida New Math may ameliorate the situation somewhat.)

default \mathbf \mathsf \mathit \mathcal \mathbb \mathfrak

X X X X X X X

x x x x § x x

0 0 0 0 ′ 0 0

[ ] [ ] [ ] [ ] [ ] [ ] [ ]

+ + + + + + +

− − − − − − −= = = = = = =

Ξ Ξ Ξ Ξ ÷ ≮

ξ ξ ξ ξ ξ ξ ξ

∞ ∞ ∞ ∞ ∞ ∞ ∞ℵ ℵ ℵ ℵ ℵ ℵ ℵ∑ ∑ ∑ ∑ ∑ ∑ ∑q q q q q q q< < < < < < <

A common desire is to get a bold version of a particular math symbol. For those symbolswhere \mathbf is not applicable, the \boldsymbol or \pmb commands can be used.

A∞ + πA0 ∼ A∞ + πA0 ∼ AAA∞∞∞ +++ πππAAA000 (3.1)

A_\infty + \pi A_0\sim \mathbfA_\boldsymbol\infty \boldsymbol+\boldsymbol\pi \mathbfA_\boldsymbol0

\sim\pmbA_\pmb\infty \pmb+\pmb\pi \pmbA_\pmb0

The \boldsymbol command is obtained preferably by using the bm package, which providesa newer, more powerful version than the one provided by the amsmath package. Generallyspeaking, it is ill-advised to apply \boldsymbol to more than one symbol at a time.

3.18.1. Calligraphic letters (cmsy; no lowercase)

Usage: \mathcalM.

AB C D E F G HI J KLMN OP QRS T U V W X Y Z

Page 94: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 10

3.18.2. Blackboard Bold letters (msbm; no lowercase)

Usage: \mathbbR.

ABCDEFGHI JKLMNOPQRSTUVWXYZ

3.18.3. Fraktur letters (eufm)

Usage: \mathfrakS.AB CDE FG H I J K LM N O P QR ST UV W X YZ

a b c d e f g h i j k l m n o p q r s t u vw x y z

4. Notations

4.1. Top and bottom embellishments These are visually similar to accents but gen-erally span multiple symbols rather than being applied to a single base symbol. For easeof reference, \widetilde and \widehat are redundantly included here and in the table ofmath accents.

xxx \widetildexxx

xxx \widehatxxx

xxx \overlinexxx

xxx \underlinexxx

︷︸︸︷xxx \overbracexxx

xxx︸︷︷︸ \underbracexxx←−−xxx \overleftarrowxxx

xxx←−− \underleftarrowxxx

−−→xxx \overrightarrowxxxxxx−−→ \underrightarrowxxx←→xxx \overleftrightarrowxxxxxx←→ \underleftrightarrowxxx

4.2. Extensible arrows \xleftarrow and \xrightarrow produce arrows that extendautomatically to accommodate unusually wide subscripts or superscripts. These commandstake one optional argument (the subscript) and one mandatory argument (the superscript,possibly empty):

An+µ−1←−−−−− B n±i−1−−−−→

TC (4.1)

\xleftarrown+\mu-1\quad \xrightarrow[T]n\pm i-1

4.3. Affixing symbols to other symbols In addition to the standard accents (Sec-tion 3.16), other symbols can be placed above or below a base symbol with the \overset and\underset commands. For example, writing \overset*X will place a superscript-size

∗ above the X, thus:∗X. See also the description of \sideset in Section 8.3.

4.4. Matrices The environments pmatrix, bmatrix, Bmatrix, vmatrix and Vmatrixhave (respectively) ( ), [ ], , | |, and ‖ ‖ delimiters built in. There is also a matrix environ-ment sans delimiters, and an array environment that can be used to obtain left alignmentor other variations in the column specs.

\beginpmatrix\alpha& \beta^*\\\gamma^*& \delta\endpmatrix

(α β∗

γ∗ δ

)

To produce a small matrix suitable for use in text, there is a smallmatrix environment(e.g.,

(a bc d

)) that comes closer to fitting within a single text line than a normal matrix.

This example was produced by

\bigl( \beginsmallmatrixa&b\\ c&d

\endsmallmatrix \bigr)

To produce a row of dots in a matrix spanning a given number of columns, use \hdotsfor.For example, \hdotsfor3 in the second column of a four-column matrix will print a rowof dots across the final three columns.

For piece-wise function definitions there is a cases environment:

Page 95: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 11

P_r-j=\begincases0& \textif $r-j$ is odd,\\r!\,(-1)^(r-j)/2& \textif $r-j$ is even.

\endcases

Notice the use of \text and the embedded math.

Note. The plain TEX form \matrix...\cr...\cr and the related commands \pmatrix, \cases should beavoided in LATEX (and when the amsmath package is loaded they are disabled).

4.5. Math spacing commands When the amsmath package is used, all of these mathspacing commands can be used both in and out of math mode.

Abbrev. Spelled out Example Abbrev. Spelled out Exampleno space 34 no space 34

\, \thinspace 3 4 \! \negthinspace 34\: \medspace 3 4 \negmedspace 34\; \thickspace 3 4 \negthickspace 34

\quad 3 4\qquad 3 4

For finer control over math spacing, use \mspace and ‘math units’. One math unit, or mu,is equal to 1/18 em. Thus to get a negative half \quad write \mspace-9.0mu.

4.6. Dots For preferred placement of ellipsis dots (raised or on-line) in various contextsthere is no general consensus. It may therefore be considered a matter of taste. By usingthe semantically oriented commands

• \dotsc for “dots with commas”

• \dotsb for “dots with binary operators/relations”

• \dotsm for “multiplication dots”

• \dotsi for “dots with integrals”

• \dotso for “other dots” (none of the above)

instead of \ldots and \cdots, you make it possible for your document to be adapted todifferent conventions on the fly, in case (for example) you have to submit it to a publisherwho insists on following house tradition in this respect. The default treatment for thevarious kinds follows American Mathematical Society conventions:

We have the series $A_1,A_2,\dotsc$,

the regional sum $A_1+A_2+\dotsb$,

the orthogonal product $A_1A_2\dotsm$,

and the infinite integral

\[\int_A_1\int_A_2\dotsi\].

We have the series A1, A2, . . . , the re-gional sum A1 +A2 + · · · , the orthogonalproduct A1A2 · · · , and the infinite inte-gral ∫

A1

∫A2

· · · .

4.7. Nonbreaking dashes The command \nobreakdash suppresses the possibility of alinebreak after the following hyphen or dash. For example, if you write ‘pages 1–9’ aspages 1\nobreakdash--9 then a linebreak will never occur between the dash and the 9.You can also use \nobreakdash to prevent undesirable hyphenations in combinations like$p$-adic. For frequent use, it’s advisable to make abbreviations, e.g.,

\newcommand\p$p$\nobreakdash% for "\p-adic"\newcommand\Ndash\nobreakdash\textendash% for "pages 1\Ndash 9"% For "\n dimensional" ("n-dimensional"):\newcommand\n[1]$n$\nobreakdash-\hspace0pt

The last example shows how to prohibit a linebreak after the hyphen but allow normalhyphenation in the following word. (It suffices to add a zero-width space after the hyphen.)

Page 96: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 12

4.8. Roots The command \sqrt produces a square root. To specify an alternate radixgive an optional argument.

\sqrt\fracnn-1 S

√n

n− 1S, \sqrt[3]2

3√

2

4.9. Boxed formulas The command \boxed puts a box around its argument, like \fboxexcept that the contents are in math mode:

η ≤ C(δ(η) + ΛM (0, δ)) (4.2)

\boxed\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))

If you need to box an equation including the equation number, see the FAQ that comeswith the amsmath package.

5. Fractions and related constructions

5.1. The \frac, \dfrac, and \tfrac commands The \frac command takes two ar-guments—numerator and denominator—and typesets them in normal fraction form. Use\dfrac or \tfrac to overrule LATEX’s guess about the proper size to use for the fraction’scontents (t = text-style, d = display-style).

1k

log2 c(f) 1k log2 c(f) (5.1)

\beginequation\frac1k\log_2 c(f)\;\tfrac1k\log_2 c(f)\;\endequation

<z =nπ

θ + ψ

2(θ + ψ

2

)2

+(

12

log∣∣∣∣BA∣∣∣∣)2 . (5.2)

\beginequation\Rez =\fracn\pi \dfrac\theta +\psi2

\left(\dfrac\theta +\psi2\right)^2 + \left( \dfrac12\log \left\lvert\dfracBA\right\rvert\right)^2.

\endequation

5.2. The \binom, \dbinom, and \tbinom commands For binomial expressions such as(nk

)there are \binom, \dbinom and \tbinom commands:

2k −(k

1

)2k−1 +

(k

2

)2k−2 (5.3)

2^k-\binomk12^k-1+\binomk22^k-2

5.3. The \genfrac command The capabilities of \frac, \binom, and their variants aresubsumed by a generalized fraction command \genfrac with six arguments. The last twocorrespond to \frac’s numerator and denominator; the first two are optional delimiters(as seen in \binom); the third is a line thickness override (\binom uses this to set thefraction line thickness to 0—i.e., invisible); and the fourth argument is a mathstyle override:integer values 0–3 select respectively \displaystyle, \textstyle, \scriptstyle, and\scriptscriptstyle. If the third argument is left empty, the line thickness defaults to‘normal’.

\genfracleft-delimright-delimthicknessmathstylenumeratordenominator

Page 97: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 13

To illustrate, here is how \frac, \tfrac, and \binom might be defined.

\newcommand\frac[2]\genfrac#1#2\newcommand\tfrac[2]\genfrac1#1#2\newcommand\binom[2]\genfrac()0pt#1#2

Note. For technical reasons, using the primitive fraction commands \over, \atop, \above in a LATEX doc-ument is not recommended (see, e.g., amsmath.faq).

5.4. Continued fractions The continued fraction

1√

2 +1

√2 +

1√

2 + · · ·

(5.4)

can be obtained by typing

\cfrac1\sqrt2+\cfrac1\sqrt2+\cfrac1\sqrt2+\dotsb

This produces better-looking results than straightforward use of \frac. Left or rightplacement of any of the numerators is accomplished by using \cfrac[l] or \cfrac[r]instead of \cfrac.

6. Delimiters

6.1. Delimiter sizes Unless you indicate otherwise, delimiters in math formulas willremain at the standard size regardless of the height of the enclosed material. To get largersizes, you can either select a particular size using a \big... prefix (see below), or you canuse \left and \right prefixes for autosizing.

The automatic delimiter sizing done by \left and \right has two limitations: First,it is applied mechanically to produce delimiters large enough to encompass the largestcontained item, and second, the range of sizes has fairly large quantum jumps. This meansthat an expression that is infinitesimally too large for a given delimiter size will get thenext larger size, a jump of 6pt or so (3pt top and bottom) in normal-sized text. There aretwo or three situations where the delimiter size is commonly adjusted. These adjustmentsare done using the following commands:

Delimiter text \left \bigl \Bigl \biggl \Bigglsize size \right \bigr \Bigr \biggr \Biggr

Result (b)(c

d) (b)

( cd

) (b)( cd

) (b)( c

d

) (b

)(c

d

) (b

)(c

d

)The first kind of adjustment is done for cumulative operators with limits, such as summationsigns. With \left and \right the delimiters usually turn out larger than necessary, andusing the Big or bigg sizes instead gives better results:∑

i

ai

∣∣∣∣∣∣∑

j

xij

∣∣∣∣∣∣p1/p

versus[∑

i

ai

∣∣∣∑j

xij

∣∣∣p]1/p

\biggl[\sum_i a_i\Bigl\lvert\sum_j x_ij\Bigr\rvert^p\biggr]^1/p

Page 98: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 14

The second kind of situation is clustered pairs of delimiters where \left and \right makethem all the same size (because that is adequate to cover the encompassed material) butwhat you really want is to make some of the delimiters slightly larger to make the nestingeasier to see.

((a1b1)− (a2b2)) ((a2b1) + (a1b2)) versus((a1b1)− (a2b2)

)((a2b1) + (a1b2)

)\left((a_1 b_1) - (a_2 b_2)\right)\left((a_2 b_1) + (a_1 b_2)\right)\quad\textversus\quad\bigl((a_1 b_1) - (a_2 b_2)\bigr)\bigl((a_2 b_1) + (a_1 b_2)\bigr)

The third kind of situation is a slightly oversize object in running text, such as∣∣∣ b′d′ ∣∣∣ where

the delimiters produced by \left and \right cause too much line spreading. In that case\bigl and \bigr can be used to produce delimiters that are larger than the base size butstill able to fit within the normal line spacing:

∣∣ b′d′

∣∣.6.2. Vertical bar notations The use of the | character to produce paired delimiters isnot recommended. There is an ambiguity about the directionality of the symbol that will inrare cases produce incorrect spacing—e.g., |k|=|-k| |k| = | − k|. Using \lvert for a “leftvert bar” and \rvert for a “right vert bar” whenever they are used in pairs will prevent thisproblem. For double bars there are analogous \lVert, \rVert commands. Recommendedpractice is to define suitable commands in the document preamble for any paired-delimiteruse of vert bar symbols:

\providecommand\abs[1]\lvert#1\rvert\providecommand\norm[1]\lVert#1\rVert

whereupon \absz would produce |z| and \normv would produce ‖v‖.

7. The \text command The main use of the command \text is for words or phrasesin a display. It is similar to \mbox in its effects but, unlike \mbox, automatically producessubscript-size text if used in a subscript.

f[xi−1,xi] is monotonic, i = 1, . . . , c+ 1 (7.1)

f_[x_i-1,x_i] \text is monotonic,\quad i = 1,\dots,c+1

7.1. \mod and its relatives Commands \mod, \bmod, \pmod, \pod deal with the specialspacing conventions of “mod” notation. \mod and \pod are variants of \pmod preferred bysome authors; \mod omits the parentheses, whereas \pod omits the “mod” and retains theparentheses.

gcd(n,m mod n); x ≡ y (mod b); x ≡ y mod c; x ≡ y (d) (7.2)

\gcd(n,m\bmod n);\quad x\equiv y\pmod b;\quad x\equiv y\mod c;\quad x\equiv y\pod d

8. Integrals and sums

8.1. Multiple integral signs \iint, \iiint, and \iiiint give multiple integral signswith the spacing between them nicely adjusted, in both text and display style. \idotsintis an extension of the same idea that gives two integral signs with dots between them.∫∫

A

f(x, y) dx dy∫∫∫

A

f(x, y, z) dx dy dz (8.1)

∫∫∫∫A

f(w, x, y, z) dw dx dy dz∫· · ·∫

A

f(x1, . . . , xk) (8.2)

Page 99: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Short Math Guide for LATEX, version 1.07 (2000/07/19) 15

8.2. Multiline subscripts and superscripts The \substack command can be usedto produce a multiline subscript or superscript: for example

\sum_\substack0\le i\le m\\0<j<n

P(i,j)

∑0≤i≤m0<j<n

P (i, j)

8.3. The \sideset command There’s also a command called \sideset, for a ratherspecial purpose: putting symbols at the subscript and superscript corners of a symbollike

∑or∏

. Note: The \sideset command is only designed for use with large operatorsymbols; with ordinary symbols the results are unreliable. With \sideset, you can write

\sideset’\sum_n<k,\;\text$n$ odd nE_n

∑′

n<k, n odd

nEn

The extra pair of empty braces is explained by the fact that \sideset has the capability ofputting an extra symbol or symbols at each corner of a large operator; to put an asteriskat each corner of a product symbol, you would type

\sideset_*^*_*^*\prod∗

∏∗

9. Other packages of interest Many other LATEX packages that address some aspectof mathematical formulas are available from CTAN (the Comprehensive TEX Archive Net-work). To recommend a few examples:

accents Under accents and accents using arbitrary symbols.

amsthm General theorem and proof setup.

bm Bold math package, provides a more general and more robust implementation of\boldsymbol.

cases Apply a large brace to two or more equations without losing the individual equationnumbers.

delarray Delimiters spanning multiple rows of an array.

kuvio Commutative diagrams and other diagrams.

xypic Commutative diagrams and other diagrams.

rsfs Ralph Smith’s Formal Script, font setup.

References

[Lamport] Lamport, Leslie: LATEX: a document preparation system, 2nd edition, Addison-Wesley, 1994.

[LaTeX-U] LATEX3 Project Team: LATEX2ε for authors, usrguide.tex, 1994.

[LaTeX-F] LATEX3 Project Team: LATEX2ε font selection, fntguide.tex, 1994.

[LaTeX-G] Carlisle, D. P.: Packages in the ‘graphics’ bundle, grfguide.tex, 1995.

[GMS] Goossens, Michel; Mittelbach, Frank; Samarin, Alexander: The LATEX Com-panion, Addison-Wesley, 1994.

[GMR] Goossens, Michel; Rahtz, Sebastian; Mittelbach, Frank: The LATEX GraphicsCompanion, Addison Wesley Longman, 1997.

[AMUG] American Mathematical Society: User’s Guide for the amsmath package,amsldoc.tex, 1999.

Page 100: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Summary of Commonly-Used Features of LaTEX

D. R. Wilkins

November 19, 1993

Contents

1 Rules for Ordinary Text (without mathematics) 21.1 Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Quotation marks . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Dashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Changing Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6 Accents in Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.7 Producing Blank Space in LaTEX . . . . . . . . . . . . . . . . . . . 41.8 Forcing Blank Spaces and Preventing Line Breaks . . . . . . . . . 4

2 Rules for obtaining Mathematical Formulae 52.1 Mathematics embedded in Text . . . . . . . . . . . . . . . . . . . 52.2 Displayed Mathematical Formulae . . . . . . . . . . . . . . . . . . 52.3 Special Characters in Mathematics Mode . . . . . . . . . . . . . . 52.4 Superscripts and Subscripts . . . . . . . . . . . . . . . . . . . . . 62.5 Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.6 Mathematical Symbols . . . . . . . . . . . . . . . . . . . . . . . . 62.7 Accents in Mathematics . . . . . . . . . . . . . . . . . . . . . . . 62.8 Standard Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 62.9 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.10 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.11 Ellipsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.12 Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.13 Embedding Text in Mathematics . . . . . . . . . . . . . . . . . . 72.14 Inserting and Removing Blank Space in Formulae . . . . . . . . . 82.15 Further Features of LaTEX . . . . . . . . . . . . . . . . . . . . . . 8

A Control Sequences used in Text (LaTEX) 9

1

Page 101: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

B Control Sequences used in Mathematics (LaTEX) 10B.1 Font Changes, Accents and Standard Functions . . . . . . . . . . 10B.2 Control Sequences for Mathematical Symbols . . . . . . . . . . . 11B.3 Some frequently used Control Sequences of LaTEX . . . . . . . . . 14

1 Rules for Ordinary Text (without mathemat-

ics)

1.1 Special Characters

All characters on the keyboard have their standard meaning in ordinary text withthe exception of the special characters

# $ % & ~ _ ^ \ ’

which have special functions within TEX. On the rare occasions when these spe-cial characters are required in the final document they must be produced by anappropriate control sequence. Thus you should type \#, \$, \%, \&, \_, \ and\ to obtain #, $, %, &, , and respectively.

1.2 Paragraphs

Successive paragraphs in the input file should be separated by a completely blankline. All paragraphs will be automatically indented by TEX with the exception ofthe first paragraph of a new section. (One can override the conventions of TEXby placing the control sequence \noindent of the control sequence \indent atthe beginning of the paragraph.)

1.3 Quotation marks

To produce single quotation marks use the characters ‘ (left quote) and ’ (rightquote). For double quotation marks use ‘‘ (two left quotes) and ’’ (two rightquotes). Do not use " (undirected double quote). Thus to obtain

“This is easy” he said.

you should type

‘‘This is easy’’ he said.

The control sequence \, can be used to separate single quotes from doublequotes where necessary.

2

Page 102: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

1.4 Dashes

Dashes of various lengths are obtained using -, -- and ---. You should use- for hyphenation, -- when specifying ranges of numbers, and --- to obtain apunctuation dash. Thus we obtain

The Cayley-Hamilton Theorem.

See pages 95–104.

Use three dashes to obtain a punctuation dash—like this.

by typing

The Cayley-Hamilton Theorem.

See pages 95--104.

Use three dashes to obtain a punctuation dash---like this.

1.5 Changing Fonts

The control sequences \rm, \sl, \it, \tt and \bf change to roman, slanted,italic, teletype and boldface fonts respectively. Any change of font made withina group enclosed within curly brackets and will only apply to text within thatgroup. On leaving the group, the current font is restored to what it was beforeentering the group. Thus we can obtain

This sentence contains a word set in boldface type

by typing

This sentence contains a word set in \bf boldface type

The control sequence \/ produces the so-called ‘italic correction’. It is some-times desirable when changing from a slanted font (such as italic or slanted) backto a non-slanted font such as roman or boldface, in order to produce a smallamount of extra space to compensate for the slantedness of the font, and thus im-prove the appearance of the final document. However the italic correction shouldnot be applied before a period (full stop) or a comma. To obtain

Here is some italicized text.

one should type

Here is some \it italicized\/ text.

However it usually does not matter all that much if you forget about this italiccorrection.

In LaTEX there is also a control sequence \em for emphasizing text. This controlsequence changes to the italic font, unless we are already in the italic font, inwhich case it converts to the roman font.

3

Page 103: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

1.6 Accents in Text

These are produced by control sequences such as \’, \‘ and \". Thus one typesSe\’an and H\"older to obtain ‘Sean’ and ‘Holder’ respectively. For afull list of such accents, see Appendix A. Note however that accents withinmathematics are produced in a different fashion.

1.7 Producing Blank Space in LaTEX

To produce (horizontal) blank space within a paragraph, use \hspace and \hspace*,followed by the length of the blank space enclosed within curly brackets. Thelength of the skip should be expressed in a unit recognized by TEX. These recog-nized units are given in the following table:

pt point (1 in = 72.27 pt)pc pica (1 pc = 12 pt)in inch (1 in = 25.4 mm)bp big point (1 in = 72 bp)cm centimetre (1 cm = 10 mm)mm millimetredd didot point (1157 dd = 1238 pt)cc cicero (1 cc = 12 dd)sp scaled point (65536 sp = 1 pt)

Thus to produce a horizontal blank space of 20 mm in the middle of a paragraphone would type \hspace20 mm (or \hspace*20 mm.

The difference between \hspace and \hspace* is that if TEX decides to breakbetween lines at the point where an \hspace is specified, then the \hspace isignored. Using \hspace* forces TEX to produce a horizontal space, whether ofnot TEX breaks between lines.

To produce (vertical) blank space between paragraphs, use \vspace and\vspace*, followed by the length of the blank space enclosed within curly brack-ets. A \vspace will be ignored if it comes at a break between pages, whereasblank space will always be produced by \vspace*, whether or not there is a pagebreak.

1.8 Forcing Blank Spaces and Preventing Line Breaks

To force TEX to produce a blank space where it might not otherwise put one,one should precede the blank space with a \ (backslash). It is often advisable toprecede with a backslash blank spaces after certain abbreviations such as ‘Dr.’,‘etc.’, and ‘Math. Soc.’ (so that one should type Dr.\ Smith etc.).

If you wish to ensure that TEX does not start a new line at a particular blankspace, then you can use ~ in place of the blank space. Thus if you type I.~Newtonor Example~4 then you prevent a line break at these places.

4

Page 104: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2 Rules for obtaining Mathematical Formulae

2.1 Mathematics embedded in Text

Any mathematical expressions embedded in text should be preceded and followedby the character $. Thus to obtain

Let f be the function defined by f(x) = x + 7.

one should type

Let $f$ be the function defined by $f(x) = x + 7$.

2.2 Displayed Mathematical Formulae

Any displayed mathematical formula should be preceded by \[ and followed by\]. Thus to obtain

Let g be the function defined by

g(x, y) = xy + x + y + 2.

The function g is positive when both x and y are positive.

one should type

Let $g$ be the function defined by

\[ g(x,y) = xy + x + y + 2. \]

The function $g$ is positive when both $x$ and $y$

are positive.

2.3 Special Characters in Mathematics Mode

All characters on the keyboard have their standard meaning in mathematicalexpressions with the exception of the special characters

# $ % & ~ _ ^ \ ’

which have special functions within TEX. On the rare occasions when these spe-cial characters are required in the final document they must be produced by anappropriate control sequence. Thus you should type \#, \$, \%, \&, \_, \ and\ to obtain #, $, %, &, , and respectively. To obtain \ in mathematicsmode, type \backslash.

The character ’ is used to put a superscript prime after a character. Thus ifwe type $f’$ and $g’’$ we obtain f ′ and g′′ respectively.

5

Page 105: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2.4 Superscripts and Subscripts

Superscripts and subscripts are produced using the characters ^ and _ respec-tively. Thus we obtain t2 + x1 − x3

1 by typeint $t^2 + x_1 - x^3_1$. If a su-perscript or subscript consists of more than one character then the superscriptsand subscripts should be enclosed in curly brackets. Thus one obtains ai,j bytyping $a_i,j$. One can obtain double subscripts: we obtain snj by typing$s_n_j$.

2.5 Greek Letters

Greek letters are obtained by preceding the name of the letter by a backslash.Thus we obtain α, β, γ by typing $\alpha, \beta, \gamma$. See Appendix B fora list of Greek letters. Some Greek letters have variant forms—see Appendix B.

2.6 Mathematical Symbols

Mathematical symbols such as ÷, ≡, ⊗, ∑, ∈, ∪, ∩ and → are obtained using

the appropriate control sequences—see Appendix B.

2.7 Accents in Mathematics

These are produced using the appropriate control sequence—see Appendix B.

2.8 Standard Functions

Certain standard functions such as sin and log are obtained by preceding thename with a backslash—see Appendix B for a full list of these. To obtain afunction or similar expression not on this list you should convert to the romanfont (e.g., to obtain Aut(G) one should type $\rm Aut(G)$).

2.9 Fractions

Fractions are obtained in LaTEX using the control sequence \frac. We type

\frac numerator denominator

to obtain the required fraction. Thus to obtain

f(x) =2x

(1 + x2)2

we type

\[ f(x) = \frac2 x(1 + x^2)^2 \]

6

Page 106: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2.10 Roots

Square roots are obtained using the control sequence \sqrt. Thus to obtain√3x+ 7 we type $\sqrt3x + 7$. To obtain an nth root in LaTEX we use the

construction

\sqrt[n] expression

Thus 3√3x + 7 is obtained by typing $\sqrt[3]3x + 7$.

2.11 Ellipsis

Ellipsis (three dots) is obtained in mathematical formulae using the control se-quences \cdots (centred ellipsis) and \ldots (lowered ellipsis). Thus to obtainx1 + x2 + · · ·+ xn and x1, x2, . . . , xn we type $x_1 + x_2 + \cdots + x_n$ and$x_1, x_2, \ldots, x_n$ respectively.

2.12 Delimiters

To surround a subformula with delimiters large enough to enclose the subformulawe use the construction

\left( . . . subformula . . . \right)

(where the parentheses ( . . . ) may be replaced by any other pair of delimiterssuch as [ . . . ] or \ . . . \). Thus to obtain the equation

f(x) =(1 +

2x

x2 + 1

)− sin(x)

we type

\[ f(x) = \left( 1 + \frac2xx^2 + 1 \right) - \sin(x) \]

2.13 Embedding Text in Mathematics

Text can be embedded in mathematics using the control sequence \mbox. Thusif we type

\[ V’ = \ f \in X’ : f(v) = 0 \mbox for all v \in V \ \]

we obtainV ′ = f ∈ X ′ : f(v) = 0 for all v ∈ V

7

Page 107: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2.14 Inserting and Removing Blank Space in Formulae

The control sequence \quad produces a ‘quad’ of blank space (a ‘quad’ is approx-imately the width of the letter ‘m’). The control sequence \, inserts a thin blankspace and the control sequence \! removes a thin space. One uses \, and \! toimprove the appearance of mathematical formulae. For example, if we type

\[ \int_0^\pi \sin x dx = 2, \]

we obtain ∫ π

0sin xdx = 2,

whereas if we type

\[ \int_0^\pi \sin x \,dx = 2, \]

we obtain ∫ π

0sinx dx = 2,

and this equation has a more satisfactory appearance.

2.15 Further Features of LaTEX

There are plenty of control sequences and ‘environments’ in LaTEX for accom-plishing various tasks. Among the most widely used environments are

\beginequation ... \endequation

(produces a numbered displayed formula)

\begineqnarray ... \endeqnarray

(produces a numbered displayed multiline formula)

begineqnarray* ... \endeqnarray*

(produces an unnumbered displayed multiline formula)

\beginarray ... \endarray

(produces an array or matrix)

8

Page 108: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

A Control Sequences used in Text (LaTEX)

Control Sequences for Changing Fonts in Text

\rm changes to the normal “roman” font: Roman\sl changes to a slanted roman font: Slanted\it changes to an italic font: Italic\tt changes to an “typewriter” font: Typewriter

\bf changes to a boldface font: Boldface

In LaTEX the control sequence \em emphasizes text, switching from non-italicto italic and from italic to roman.

Control Sequences for obtaining Accents in Text

\’e e e.g., math\’ematique yields ‘mathematique’\‘e e e.g., alg\‘ebre yields ‘algebre’\^e e e.g., h\^ote yields ‘hote’\"o o e.g., H\"older yields ‘Holder’\~n n e.g., ma\~nana yields ‘manana’\=o o\.o o\uo o\vc c e.g., \vCech yields ‘Cech’\Ho o\too oo\cc c e.g., gar\ccon yields ‘garcon’\do o.\bo o

¯

These accents are for use in ordinary text. They cannot be used within math-ematical formulae, since different control sequences are used to produce accentswithin mathematics.

Special Symbols used in Text

9

Page 109: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\oe, \OE œ, Œ\ae, \AE æ, Æ\aa, \AA a, A\o, \O ø, Ø\l, \L _l, _L\ss ß?‘ ¿!‘ ¡\dag †\ddag ‡\S §\P ¶\copyright c©\pounds £\i ı\j

B Control Sequences used in Mathematics (LaTEX)

B.1 Font Changes, Accents and Standard Functions

Changing Fonts in Mathematical Expressions

Fonts are changed using suitable control sequences.

\mit changes to the ‘math italic’ font: MathItalic\rm changes to the roman font: Roman\sl changes to a slanted roman font: Slanted\it changes to an italic font: Italic\tt changes to an “typewriter” font: Typewriter\bf changes to a boldface font: Boldface\cal changes to a calligraphic font: CALLIGRAPHIC

The default font for mathematics is MathItalic. The CALLIGRAPHIC fontis only available for uppercase letters. Any change of font made within a groupenclosed within curly brackets and will only apply to text within that group.On leaving the group, the current font is restored to what it was before enteringthe group.

Accents in Mathematics Mode

Accents in mathematics mode are produced using appropriate control se-quences. The effect of these on the letter a is exhibited in the following table.

10

Page 110: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

$\underlinea$ a$\overlinea$ a$\hata$ a$\checka$ a$\tildea$ a$\acutea$ a$\gravea$ a$\dota$ a$\ddota$ a$\brevea$ a$\bara$ a$\veca$ *a

These control sequences should only be used for mathematics, not for ordinarytext.

You should bear in mind that when a character is underlined in a mathemat-ical manuscript then it is normally typeset in bold face without any underlining.Underlining is used very rarely in print.

Standard Functions

The names of certain standard functions and abbreviations are obtained bytyping a backlash \ before the name. The complete list in TEX is as follows:-

\arccos \cos \csc \exp \ker \limsup \min \sinh\arcsin \cosh \deg \gcd \lg \ln \Pr \sup\arctan \cot \det \hom \lim \log \sec \tan\arg \coth \dim \inf \liminf \max \sin \tanh

B.2 Control Sequences for Mathematical Symbols

Lowercase Greek Lettersα \alpha ι \iota , \varrho

β \beta κ \kappa σ \sigma

γ \gamma λ \lambda ς \varsigma

δ \delta µ \mu τ \tau

ε \epsilon ν \nu υ \upsilon

ε \varepsilon ξ \xi φ \phi

ζ \zeta o o ϕ \varphi

η \eta π \pi χ \chi

θ \theta @ \varpi ψ \psi

ϑ \vartheta ρ \rho ω \omega

11

Page 111: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Uppercase Greek Letters

Γ \Gamma Ξ \Xi Φ \Phi

∆ \Delta Π \Pi Ψ \Psi

Θ \Theta Σ \Sigma Ω \Omega

Λ \Lambda Υ \Upsilon

Miscellaneous Symbols

ℵ \aleph ′ \prime ∀ \forall

h \hbar ∅ \emptyset ∃ \exists

ı \imath ∇ \nabla ¬ \neg

\jmath√

\surd G \flat

H \ell \top I \natural

℘ \wp ⊥ \bot K \sharp

\Re ‖ \| ♣ \clubsuit

\Im \angle ♦ \diamondsuit

∂ \partial " \triangle ♥ \heartsuit

∞ \infty \ \backslash ♠ \spadesuit

“Large” Operators

∑\sum

⋂\bigcap

⊙\bigodot∏

\prod⋃

\bigcup⊗

\bigotimes∐\coprod

⊔\bigsqcup

⊕\bigoplus∫

\int∨

\bigvee⊎

\biguplus∮\oint

∧\bigwedge

Binary Operations

± \pm ∩ \cap ∨ \vee

∓ \mp ∪ \cup ∧ \wedge

\ \setminus * \uplus ⊕ \oplus

· \cdot , \sqcap - \ominus

× \times / \sqcup ⊗ \otimes

∗ \ast M \triangleleft 1 \oslash

N \star O \triangleright 2 \odot

3 \diamond 4 \wr † \dagger

\circ © \bigcirc ‡ \ddagger

• \bullet " \bigtriangleup 7 \amalg

÷ \div 8 \bigtriangledown

12

Page 112: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Relations

≤ \leq ≥ \geq ≡ \equiv

≺ \prec < \succ ∼ \sim

> \preceq ? \succeq @ \simeq

A \ll B \gg C \asymp

⊂ \subset ⊃ \supset ≈ \approx

⊆ \subseteq ⊇ \supseteq ∼= \cong

I \sqsubseteq J \sqsupseteq OM \bowtie

∈ \in K \ni ∝ \propto

M \vdash N \dashv |= \models

P \smile | \mid.= \doteq

Q \frown ‖ \parallel ⊥ \perp

Negated Relations

P< \not< P> \not> P= \not=

P≤ \not\leq P≥ \not\geq P≡ \not\equiv

P≺ \not\prec P< \not\succ P∼ \not\sim

P> \not\preceq P? \not\succeq P@ \not\simeq

P⊂ \not\subset P⊃ \not\supset P≈ \not\approx

P⊆ \not\subseteq P⊇ \not\supseteq P∼= \not\cong

PI \not\sqsubseteq PJ \not\sqsupseteq PC \not\asymp

Arrows

← \leftarrow ←− \longleftarrow ↑ \uparrow

⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow

→ \rightarrow −→ \longrightarrow ↓ \downarrow

⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow

↔ \leftrightarrow ←→\longleftrightarrow Y \updownarrow

⇔ \Leftrightarrow ⇐⇒\Longleftrightarrow [ \Updownarrow

\→ \mapsto \−→ \longmapsto \nearrow

← \hookleftarrow → \hookrightarrow \searrow

\leftharpoonup \rightharpoonup \swarrow

\leftharpoondown \rightharpoondown \nwarrow \rightleftharpoons

Openings

13

Page 113: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

[ \lbrack a \lfloor \lciel

\lbrace 〈 \langle

Closings

] \rbrack c \rfloor \rciel

\rbrace 〉 \rangle

Alternative Names

P= \ne or \neq (same as \not=)≤ \le (same as \leq)≥ \ge (same as \geq) \ (same as \lbrace) \ (same as \lbrace)→ \to (same as \rightarrow)← \gets (same as \leftarrow)K \owns (same as \ni)∧ \land (same as \wedge)∨ \lor (same as \vee)¬ \lnot (same as \neg)| \vert (same as |)‖ \Vert (same as \|)⇐⇒\iff (same as \Longleftrightarrow, but with

extra space at each end): \colon (same as :, but with less space around it and

less likelihood of a line break after it)

B.3 Some frequently used Control Sequences of LaTEX

Control Sequences

We list some of the control sequences and environments of LaTEX that are fre-quently used when typesetting mathematical formulae. The list is by no meansexhaustive. For information on how to apply these control sequences, consult theappropriate manual (e.g. ‘LaTEX—User’s Guide and Reference Manual’) Here isthe list of control sequences.

14

Page 114: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\frac produces fractions\sqrt produces square roots and nth roots\left produces left delimiter of required size\right produces right delimiter of required size\, produces a thin space\! removes a thin space\mbox creates a box of text within mathematics

Environments

The following environments are often used in typesetting mathematics.

\beginequation ... \endequation

(produces a numbered displayed formula)

\begineqnarray ... \endeqnarray

(produces a numbered displayed multiline formula)

begineqnarray* ... \endeqnarray*

(produces an unnumbered displayed multiline formula)

\beginarray ... \endarray

(produces an array or matrix)

15

Page 115: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

color-package-demo.tex

Bent Petersen

Oct 24, 2000

The easiest way to use color text in LATEX2ε is to use the color package.You load the color package in your preamble as usual

\documentclass[11pt]article\usepackage[usenames]color

Here the option [usenames] causes the definitions for the 68 colors known todvips (see next page) to be preloaded. Those colors can then be specifiedby name. For example \colorBrickRed BrickRed produces BrickRed.Alternately one can use the command

\textcolorBrickRedthis is BrickRed

which produces this is BrickRed.

If the 68 predefined colors do not suffice, or if you do not want to load thedefinitions of all of them, you may define your own custom colors.

Here is a dark blue defined in terms of the RGB (red, green, blue) colormodel.

\definecolorMyDarkBluergb0,0.08,0.45\begincenter\colorMyDarkBlueThis color is MyDarkBlue\endcenter

This color is MyDarkBlue

Page 116: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Once we have defined the new color we can use it anywhere in the currentdocument. For example, \textcolorMyDarkBluea nice blue producesa nice blue.

Custom colors may also be defined in terms of the CMYK (cyan, magenta,yellow, black) color model. Here is a light magenta.

\definecolorMyLightMagentacmyk0.1,0.8,0,0.1\begincenter\colorMyLightMagentaThis color is MyLightMagenta\endcenter

This color is MyLightMagenta

The 68 standard colors known to dvips

Apricot Aquamarine Bittersweet BlackBlue BlueGreen BlueViolet BrickRedBrown BurntOrange CadetBlue CarnationPinkCerulean CornflowerBlue Cyan DandelionDarkOrchid Emerald ForestGreen FuchsiaGoldenrod Gray Green GreenYellowJungleGreen Lavender LimeGreen MagentaMahogany Maroon Melon MidnightBlueMulberry NavyBlue OliveGreen OrangeOrangeRed Orchid Peach PeriwinklePineGreen Plum ProcessBlue PurpleRawSienna Red RedOrange RedVioletRhodamine RoyalBlue RoyalPurple RubineRedSalmon SeaGreen Sepia SkyBlueSpringGreen Tan TealBlue ThistleTurquoise Violet VioletRed WhiteWildStrawberry Yellow YellowGreen YellowOrange

2

Page 117: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Name colours in textttdvipasnam.def

GreenYellow

Yellow

Goldenrod

Dandelion

Apricot

Peach

Melon

YellowOrange

Orange

BurntOrange

Bittersweet

RedOrange

Mahogany

Maroon

BrickRed

Red

OrangeRed

RubineRed

WildStrawberry

Salmon

CarnationPink

Magenta

VioletRed

Rhodamine

Mulberry

RedViolet

Fuchsia

Lavender

Thistle

Orchid

DarkOrchid

Purple

Plum

Violet

RoyalPurple

BlueViolet

Periwinkle

CadetBlue

CornflowerBlue

MidnightBlue

NavyBlue

RoyalBlue

Blue

Cerulean

Cyan

ProcessBlue

SkyBlue

Turquoise

TealBlue

Aquamarine

BlueGreen

Emerald

JungleGreen

SeaGreen

Green

ForestGreen

PineGreen

LimeGreen

YellowGreen

SpringGreen

OliveGreen

RawSienna

Sepia

Brown

Tan

Gray

Black

White

1

Page 118: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

LATEX Mathematical SymbolsThe more unusual symbols are not defined in base LATEX (NFSS) and require \usepackageamssymb

1 Greek and Hebrew letters

α \alpha κ \kappa ψ \psi z \digamma ∆ \Delta Θ \Thetaβ \beta λ \lambda ρ \rho ε \varepsilon Γ \Gamma Υ \Upsilonχ \chi µ \mu σ \sigma κ \varkappa Λ \Lambda Ξ \Xiδ \delta ν \nu τ \tau ϕ \varphi Ω \Omegaε \epsilon o o θ \theta $ \varpi Φ \Phi ℵ \alephη \eta ω \omega υ \upsilon % \varrho Π \Pi i \bethγ \gamma φ \phi ξ \xi ς \varsigma Ψ \Psi k \dalethι \iota π \pi ζ \zeta ϑ \vartheta Σ \Sigma ג \gimel

2 LATEX math constructsabcxyz \fracabcxyz abc \overlineabc

−→abc \overrightarrowabc

f ′ f’ abc \underlineabc←−abc \overleftarrowabc

√abc \sqrtabc abc \widehatabc

︷︸︸︷abc \overbraceabc

n√abc \sqrt[n]abc abc \widetildeabc abc︸︷︷︸ \underbraceabc

3 Delimiters| | \ b \lfloor / / ⇑ \Uparrow x \llcorner| \vert \ c \rfloor \ \backslash ↑ \uparrow y \lrcorner‖ \| 〈 \langle d \lceil [ [ ⇓ \Downarrow p \ulcorner‖ \Vert 〉 \rangle e \rceil ] ] ↓ \downarrow q \urcorner

Use the pair \lefts1 and \rights2 to match height of delimiters s1 and s2 to the height of their contents, e.g.,\left| expr \right| \left\ expr \right\ \left\Vert expr \right.

4 Variable-sized symbols (displayed formulae show larger version)∑\sum

∫\int

⊎\biguplus

⊕\bigoplus

∨\bigvee∏

\prod∮

\oint⋂

\bigcap⊗

\bigotimes∧

\bigwedge∐\coprod

∫∫\iint

⋃\bigcup

⊙\bigodot

⊔\bigsqcup

5 Standard Function Names

Function names should appear in Roman, not Italic, e.g., Correct: \tan(at-n\pi) −→ tan(at− nπ)Incorrect: tan(at-n\pi) −→ tan(at− nπ)

arccos \arccos arcsin \arcsin arctan \arctan arg \argcos \cos cosh \cosh cot \cot coth \cothcsc \csc deg \deg det \det dim \dimexp \exp gcd \gcd hom \hom inf \infker \ker lg \lg lim \lim lim inf \liminflim sup \limsup ln \ln log \log max \maxmin \min Pr \Pr sec \sec sin \sinsinh \sinh sup \sup tan \tan tanh \tanh

Page 119: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

6 Binary Operation/Relation Symbols

∗ \ast ± \pm ∩ \cap C \lhd? \star ∓ \mp ∪ \cup B \rhd· \cdot q \amalg ] \uplus / \triangleleft \circ \odot u \sqcap . \triangleright• \bullet \ominus t \sqcup E \unlhd© \bigcirc ⊕ \oplus ∧ \wedge D \unrhd \diamond \oslash ∨ \vee 5 \bigtriangledown× \times ⊗ \otimes † \dagger 4 \bigtriangleup÷ \div o \wr ‡ \ddagger \ \setminus \centerdot \Box Z \barwedge Y \veebar~ \circledast \boxplus f \curlywedge g \curlyvee \circledcirc \boxminus e \Cap d \Cup \circleddash \boxtimes ⊥ \bot > \topu \dotplus \boxdot ᵀ \intercal i \rightthreetimes> \divideontimes \square [ \doublebarwedge h \leftthreetimes

≡ \equiv ≤ \leq ≥ \geq ⊥ \perp∼= \cong ≺ \prec \succ | \mid6= \neq \preceq \succeq ‖ \parallel∼ \sim \ll \gg ./ \bowtie' \simeq ⊂ \subset ⊃ \supset on \Join≈ \approx ⊆ \subseteq ⊇ \supseteq n \ltimes \asymp @ \sqsubset A \sqsupset o \rtimes.= \doteq v \sqsubseteq w \sqsupseteq ^ \smile∝ \propto a \dashv ` \vdash _ \frown|= \models ∈ \in 3 \ni /∈ \notin

u \approxeq 5 \leqq = \geqq ≶ \lessgtr∼ \thicksim 6 \leqslant > \geqslant Q \lesseqgtr

v \backsim / \lessapprox ' \gtrapprox S \lesseqqgtr

w \backsimeq ≪ \lll ≫ \ggg T \gtreqqless

, \triangleq l \lessdot m \gtrdot R \gtreqless$ \circeq . \lesssim & \gtrsim ≷ \gtrlessl \bumpeq 0 \eqslantless 1 \eqslantgtr \backepsilonm \Bumpeq - \precsim % \succsim G \between+ \doteqdot w \precapprox v \succapprox t \pitchfork≈ \thickapprox b \Subset c \Supset p \shortmid; \fallingdotseq j \subseteqq k \supseteqq a \smallfrown: \risingdotseq @ \sqsubset A \sqsupset ` \smallsmile∝ \varpropto 4 \preccurlyeq < \succcurlyeq \Vdash∴ \therefore 2 \curlyeqprec 3 \curlyeqsucc \vDash∵ \because J \blacktriangleleft I \blacktriangleright \VvdashP \eqcirc E \trianglelefteq D \trianglerighteq q \shortparallel6= \neq C \vartriangleleft B \vartriangleright / \nshortparallel

\ncong \nleq \ngeq * \nsubseteq- \nmid \nleqq \ngeqq + \nsupseteq∦ \nparallel \nleqslant \ngeqslant " \nsubseteqq. \nshortmid ≮ \nless ≯ \ngtr # \nsupseteqq/ \nshortparallel ⊀ \nprec \nsucc ( \subsetneq \nsim \npreceq \nsucceq ) \supsetneq3 \nVDash \precnapprox \succnapprox $ \subsetneqq2 \nvDash \precnsim \succnsim % \supsetneqq0 \nvdash \lnapprox \gnapprox \varsubsetneq6 \ntriangleleft \lneq \gneq ! \varsupsetneq5 \ntrianglelefteq \lneqq \gneqq & \varsubsetneqq7 \ntriangleright \lnsim \gnsim ' \varsupsetneqq4 \ntrianglerighteq \lvertneqq \gvertneqq

Page 120: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

7 Arrow symbols← \leftarrow ←− \longleftarrow ↑ \uparrow⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow→ \rightarrow −→ \longrightarrow ↓ \downarrow⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow↔ \leftrightarrow ←→ \longleftrightarrow l \updownarrow⇔ \Leftrightarrow ⇐⇒ \Longleftrightarrow m \Updownarrow

7→ \mapsto 7−→ \longmapsto \nearrow← \hookleftarrow → \hookrightarrow \searrow \leftharpoonup \rightharpoonup \swarrow \leftharpoondown \rightharpoondown \nwarrow \rightleftharpoons \leadsto

99K \dashrightarrow L99 \dashleftarrow ⇔ \leftleftarrows \leftrightarrows W \Lleftarrow \twoheadleftarrow \leftarrowtail " \looparrowleft \leftrightharpoonsx \curvearrowleft \circlearrowleft \Lsh \upuparrows \upharpoonleft \downharpoonleft( \multimap ! \leftrightsquigarrow ⇒ \rightrightarrows \rightleftarrows ⇒ \rightrightarrows \rightleftarrows \twoheadrightarrow \rightarrowtail # \looparrowright \rightleftharpoons y \curvearrowright \circlearrowright \Rsh \downdownarrows \upharpoonright \downharpoonright \rightsquigarrow

8 \nleftarrow 9 \nrightarrow : \nLeftarrow; \nRightarrow = \nleftrightarrow < \nLeftrightarrow

8 Miscellaneous symbols∞ \infty ∀ \forall k \Bbbk ℘ \wp∇ \nabla ∃ \exists F \bigstar ∠ \angle∂ \partial @ \nexists \diagdown ] \measuredangleð \eth ∅ \emptyset \diagup ^ \sphericalangle♣ \clubsuit ∅ \varnothing ♦ \Diamond \complement♦ \diamondsuit ı \imath ` \Finv O \triangledown♥ \heartsuit \jmath a \Game 4 \triangle♠ \spadesuit ` \ell ~ \hbar M \vartriangle· · · \cdots

∫∫∫∫\iiiint \hslash \blacklozenge

... \vdots∫∫∫

\iiint ♦ \lozenge \blacksquare. . . \ldots

∫∫\iint f \mho N \blacktriangle

. . . \ddots ] \sharp ′ \prime H \blacktrinagledown= \Im [ \flat \square 8 \backprime< \Re \ \natural

√\surd s \circledS

9 Math mode accents

a \acutea a \bara ´A \Acute\AcuteA ¯A \Bar\BarA

a \brevea a \checka ˘A \Breve\BreveA ˇA \Check\CheckA

a \ddota a \dota ¨A \Ddot\DdotA ˙A \Dot\DotA

a \gravea a \hata `A \Grave\GraveA ˆ

A \Hat\HatA

a \tildea ~a \veca ˜A \Tilde\TildeA~~A \Vec\VecA

Page 121: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

10 Array environment, examples

Simplest version: \beginarraycols row1 \\ row2 \\ . . . rowm \endarraywhere cols includes one character [lrc] for each column (with optional characters | inserted for vertical lines)and rowj includes character & a total of (n− 1) times to separate the n elements in the row. Examples:

\left( \beginarraycc 2\tau & 7\phi-frac512 \\3\psi & \frac\pi8 \endarray \right)

\left( \beginarrayc x \\ y \endarray \right)\mbox~and~ \left[ \beginarraycc|r

3 & 4 & 5 \\ 1 & 3 & 729 \endarray \right]

(2τ 7φ− 5

123ψ π

8

) (xy

)and

[3 4 51 3 729

]

f(z) = \left\ \beginarrayrcl\overline\overlinez^2+\cos z & \mboxfor& |z|<3 \\ 0 & \mboxfor & 3\leq|z|\leq5 \\\sin\overlinez & \mboxfor & |z|>5

\endarray\right.

f(z) =

z2 + cos z for |z| < 30 for 3 ≤ |z| ≤ 5

sin z for |z| > 5

11 Other Styles (math mode only)

Caligraphic letters: $\mathcalA$ etc.: AB C D E F G HI J KLMN OP QRS T U V W X Y Z

Mathbb letters: $\mathbbA$ etc.: ABCDEFGHI JKLMNOPQRSTUVWXYZ

Mathfrak letters: $\mathfrakA$ etc.: AB CDE FG HI J K LM N O P Q RST UV W X YZ a b c 1 2 3

Math Sans serif letters: $\mathsfA$ etc.: AB CD E F GH I JK LMN O P QR STU V W XY Z a b c 1 2 3

Math bold letters: $\mathbfA$ etc.: ABCDEFGHIJKLMNOPQRSTUVWXY Z abc 123

Math bold italic letters: define \def\mathbi#1\textbf\em #1 then use $\mathbiA$ etc.:ABCDEFGHI JKLMNOPQRSTUVWXYZ a b c 1 2 3

12 Font sizes

Math Mode:

∫f−1(x− xa) dx $\displaystyle \int f^-1(x-x_a)\,dx$∫f−1(x− xa) dx $\textstyle \int f^-1(x-x_a)\,dx$∫

f−1(x−xa) dx $\scriptstyle \int f^-1(x-x_a)\,dx$∫f−1(x−xa) dx $\scriptscriptstyle \int f^-1(x-x_a)\,dx$

Text Mode:

\tiny = smallest

\scriptsize = very small

\footnotesize = smaller

\small = small

\normalsize = normal\large = large\Large = Large\LARGE = LARGE

\huge = huge\Huge = Huge

13 Text Mode: Accents and Symbols

o \’o o \"o o \^o o \‘o o \~o o \=o s. \d so \.o o \uo o \Ho oo \too o \co o. \do s \r so¯

\bo A \AA a \aa ß \ss ı \i \j s \H sø \o s \t s s \v s Ø \O ¶ \P § \Sæ \ae Æ \AE † \dag ‡ \ddag c© \copyright £ \pounds

Page 122: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Manual for the prosper class∗

Frederic GoualardCentrum voor Wiskunde en Informatica

Amsterdam, The Netherlands

Abstract

The prosper class permits producing high quality slides; it is also easily extendable. This documentationis meant to be a user manual for the predefined slide styles as well as a technical note describing how to createyour own styles.

1 Using the class

LATEX files using the prosper class may be eventually translated into two different formats:

• the Adobe® PostScriptTM format for printing transparencies;

• the Adobe® Portable Document Format (PDF) for displaying slides on computers with Acrobat® Reader infull-screen mode.

When translated into PDF files, prosper slides benefit from additional possibilities such as transition effectsbetween slides and incremental displaying of a slide with several animation effects. The currently supportedtransitions are:

• Split: two lines sweep across the screen revealing the new slide;

• Blinds: multiple lines, evenly distributed across the screen, appear and synchronously sweep in the samedirection to reveal the new slide;

• Box: a box sweeps from the center, revealing the new slide;

• Wipe: a single line sweeps across the screen from one edge to the other, revealing the new slide;

• Dissolve: the old page image dissolves to reveal the new slide;

• Glitter: similar to Dissolve, except the effect sweeps across the image in a wide band moving fromone side of the screen to the other;

• Replace: the effect is simply to replace the old page with the new page.

Figure 1 presents a bird’s-eye view of the structure of a LATEX file using the prosper class.

2 Options of the class

The prosper class supports the following options (default options are preceded by a black triangle I, while theothers are preceded by a black square ):

draft. The file is compiled in draft mode: figures are replaced by bounding boxes; the caption at the bottomof every slide displays the date and time of the compiling together with the file name;

∗This documentation describes version 1.0i of the class. CVS id = $Id: prosper-doc.tex,v 1.6 2000/12/05 14:56:48 exupery Exp

1

Page 123: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\endslideMaterial for the slide

\beginslide [transition] slide title

LegendMandatory or default choiceOptional

azure

contemporainnuancegristroispointsframes

lignesbleues

...

\maketitle

Affiliation

\begindocument

subtitle

...

Title of the presentation

Options\documentclass[ ]prosper

\title

Names of the authors\author \institution

caption text\slideCaption

Options:finaldraft

totalnototal

colorBGnocolorBG

slideBWslideColor

pspdf

\enddocument

\endslideMaterial for the slide

\beginslide [transition] slide title

\subtitle

n\overlays

accumulatenoaccumulate

Figure 1: Structure for a LATEX file using prosper

I final. The file is compiled in final mode: figures are inserted at their position; the caption on every slidecontains the text given (optionally) by the user with the macro \slideCaption, except if the macro\displayVersion appears in the preamble (in that case, the same caption as in the draft mode is used);

slideColor. Slides will use many colors. To be used with caution when the slides are to be printed on ablack & white device;

I slideBW. Slides will use a restricted set of colors. Should be used whenever the presentation is meant to beprinted in black & white;

I total. The caption at the bottom of every slide displays the number of the current slide along with the totalnumber of slides;

nototal. Only the number of the current slide appears in the caption;

I nocolorBG. The background of the slide is white whatever the style may be. It is a good idea to use thisoption for printing slides in black & white;

colorBG. The color of the background depends on the current style;

I ps. The LATEX file is compiled to produce a PostScriptTM file for printing;

pdf. The LATEX file is compiled to produce a PDF file for a presentation with a video projector;

accumulate. Macros \onlySlide, \untilSlide and \fromSlide interpret their argument in psmode. Note that it is possible to locally modify the option setting by using macros \Accumulatetrueand \Accumulatefalse;

I noaccumulate. Macros \onlySlide, \untilSlide and \fromSlide do not interpret their argumentin ps mode;

distiller. Use this option if the PostScript® file is to be translated into a PDF file using Adobe® Distiller.

2

Page 124: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

3 Predefined macros and environments

3.1 Macros to appear in the preamble

The prosper class (re-)defines some standard macros. Those given hereunder are to be put in the preamble (thatis, before \begindocument):

\title. Title of the presentation;

\subtitle. Subtitle of the presentation;

\author. Author(s) of the presentation;

\email. E-mail address of the author(s);

\institution. Name of the institute/company the author(s) come(s) from;

\slideCaptionc. Caption to be put at the bottom of every slide (name of the event/conference. . . ). Thetitle of the presentation is used as the default caption whenever the author do not override it by providing hisown caption by using this macro;

\Logo(x,y)mylogo or \Logomylogo. The logo given by mylogo will be put at the position (x,y)on each slide (resp. at a default position defined by each slide style). The reference point is bottom left. Anexample of use is:\Logo(2,5)\includegraphics[width=1cm]irinLOGO.eps)

\displayVersion. Displays a draft caption (with the name of the file, the title of the presentation, the nameof the author(s), and the date/time of the last LATEX compiling) instead of the caption defined by the usereven when in final mode;

\DefaultTransitiontrans: definition of the default transition mode between slides. By default, theReplace mode is used;

\NoFrenchBabelItemize. To be used when loading the babel style with the “french” option in order tohave the ability to choose ones own items. The french itemize glue is preserved.

3.2 The slide environment

Figure 1 describes the slide environment. An optional argument is the transition effect for displaying the slide.The default transition is R (Replace).

3.3 Some itemize environments

The Itemize environment corresponds to the LATEX itemize environment where the text is justified. In pros-per, the itemize environment has been redefined such that text is not justified in it (a better choice for slides).

There also exist an itemstep environment where each item is displayed incrementally (in PDF mode).

3.4 Macros to be used out of any slide environment

\part[transition]xx. Creates a slide only containing the text xx vertically and horizontally centered inthe font title. The transition transition—if given—will be used for this slide.

3

Page 125: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

3.5 Macros that may appear in a slide environment

\FontTitleCBW. Use this macro to change the font/color to be used for slide titles. The first argument isfor color slides, the second for black and white ones;

\FontTextCBW. Use this macro to change the font/color to be used for slide text. The first argument is forcolor slides, the second for black and white ones;

\fontTitlexx. Writes its argument using the title font and color;

\fontTextxx. Writes its argument using the text font and color;

\ColorFootcol. The footer is to be written with color col;

\PDFtransitiontr. Uses tr as the transition effect from the previous slide to the current slide;

\myitemlvldef. Defines the item of level lvl (where lvl may be 1, 2 or 3) to be def. By default, it isa green lozenge for all levels. The following code define the items to be 3D bullets of different size and color(the corresponding PostScriptTM files are provided in the img/ directory of the prosper distribution):

\myitem1\includegraphics[width=.4cm]red-bullet-on-blue.ps\myitem2\includegraphics[width=.3cm]green-bullet-on-blue.ps\myitem3\includegraphics[width=.3cm]yellow-bullet-on-blue.ps

3.6 Overlays

Overlays add animated effects to slides in PDF mode. They may be used to display a slide incrementally (inseveral steps), for making appear and disappear some elements on a slide. . . To use overlays, one has to embed thecorresponding slide environment into an \overlays macro as follows:

\overlaysn\beginslide......\endslide

The first argument (n) of the overlays macro stands for the number of steps composing the animation.The following macros may be used to control what should appear on each slide composing a n slides overlay:

• \fromSlidepmat. Puts mat on slides p through n;

• \onlySlidepmat. Puts mat on slide p only;

• \untilSlidepmat. Puts mat on slides 1 through p;

• \FromSlidep. All the material after the occurrence of the macro will be put on slides p through n;

• \OnlySlidep. All the material after the occurrence of the macro will be put on slide p only;

• \UntilSlidep. All the material after the occurrence of the macro will be put on slides 1 through p.

All those macros are only really meaningful in pdf mode; in ps mode, they do nothing or interpret their argu-ment, depending on the option no/accumulate. Macros \fromSlide, \onlySlide, and \untilSlideaccept stared versions which typeset the mat material in a zero dimension box (i.e. the position pointer is notmoved). The stared versions should be used for replacement purposes. For example, the piece of code:

\onlySlide*1\includegraphicsexample-1.eps%\onlySlide*2\includegraphicsexample-2.eps%\onlySlide*3\includegraphicsexample-3.eps%

4

Page 126: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

would put image example-1.eps on the first slide; this image would then be replaced by example-2.eps onthe second slide, and by example-3.eps on the third slide. Note the % comment sign at the end of each line: itprevents LATEX from inserting some space—due to the carriage return—which would induce a slight displacementbetween each image on the slides.Important note: keep in mind that macros \FromSlide, \OnlySlide, \UntilSlide, and the un-staredversions of \fromSlide, \onlySlide, and \untilSlide interpret the argument mat for each slide com-posing the overlay even if it is not displayed (this is mandatory in order to know the size of the box that needs bereserved for the un-displayed material).

The following macros permit choosing the material to put on a slide depending on the chosen mode (ps or pdf):

• \PDForPSifpdfifps. Interprets material ifpdf if the chosen mode is pdf, otherwise interpretsifps;

• \onlyInPSmat. Interprets material mat only if the mode is ps;

• \onlyInPDFmat. Interprets material mat only if the mode is pdf.

These macros may be used as follows:

\overlays3%\beginslideExample\onlySlide*1\includegraphicsexample-1.eps%\onlySlide*2\includegraphicsexample-2.eps%\onlySlide*3\includegraphicsexample-3.eps%\onlyInPS\includegraphicsexample.eps%\endslide

This slide will be displayed in three steps with three different figures in pdf mode; in ps mode, there will be onlyone slide containing figure example.eps.

4 Predefined styles

Figures hereunder present the currently predefined styles with options colorBG and slideColor. The nextsection presents some contributed styles by users (available in the contrib/ directory).

5 Contributed styles

This section may grow as the number of contributed styles increases. Note that the authors of these styles arecompletely responsible for supporting them.

The persons listed below (alphabetical order) have supported prosper by contributing additional great styles.Many thanks to them.

Name E-mail StyleEric Languenou [email protected] ricoGuillaume Raschia [email protected] gyom

6 Warning

The prosper slide styles are not bound to provide the same display area. Consequently, using different stylesmay require some adjustment in the text and graphics positioning.

5

Page 127: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

The quest for π

• The following formula computes 8 correct digits periteration (Ramanujan):

1

π

=∞

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 2: Style frames in color

The quest for π

• The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 3: Style lignesbleues in color

The quest for π

• The following formula computes 8 correct digitsper iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 4: Style azure in color

The quest for π

• The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 5: Style troispoints in color

The quest for π

• The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 6: Style contemporain in color

The quest for π

• The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 7: Style nuancegris in color

6

Page 128: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

The quest for π

The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 8: Style darkblue in color

The quest for π

The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=∞

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 9: Style alien glow in color

The quest for π

The following formula computes 8 correct digits periteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 10: Style autumn in color

The quest for π

The following formula computes 8 correctdigits per iteration (Ramanujan):

1

π

=

∞∑

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 11: Contributed style gyom in color

The quest for π

The following formula computes 8 correct digits periteration (Ramanujan):

1

π

=∞

n=0

(1

4)n(2

4)n(3

4)n

n!3(

2√

2(1103 + 26390n)) 1

(992)2n+1

. – p.1/1

Figure 12: Contributed style rico in color

7

Page 129: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

7 The Compilation Process

The compilation process slightly differs depending on the intended use of the slides. It is sketched in Fig. 13. Ifyou plan to print slides on transparencies, you should select the ps option and create a PostScriptTM file, while ifyou want to display them with a computer and an overhead projector, you should select the pdf option and createa PDF file from the PostScriptTM file. Translation of a PostScriptTM file into a PDF file is done by the programps2pdf included in the GhostScript distribution.

LaTeX DVI PostScript

PDF

latex

On−screen display

Transparencies

ps2pdf

dvipsone

Adobe distiller

dvips

...

Figure 13: Compilation process

Important note: PDF file should be made resolution independent by using vectorial fonts only (no TEX bitmapfonts). To do so, you have to use a GhostScript version at least equal to 6.0. You also need to create a .dvipsrcfile in your home directory with the following lines:

p +psfonts.cmzp +psfonts.amz

Last, prosper styles have been devised to be used with A4 European paper format. Consequently, you willhave to instruct GhostScript to use the appropriate format by defining the GS OPTIONS environment variable to"-sPAPERSIZE=a4". If you use bash as your main shell, this is done by adding the line

export GS_OPTIONS="-sPAPERSIZE=a4"

in your .bash_profile file.You will need Adobe® Acrobat® Reader (acroread) to display PDF files. It is available for free on the

Adobe® web site. Acrobat® Reader provides a full-screen mode that is particularly handy for presentations.

8 Devising new slide styles

Devising new prosper styles is an easy task provided you know the basics of Van Zandt’s PSTricks package(refer to PSTricks: PostScriptTM macros for Generic TEX, User’s Guide, Timothy Van Zandt). In order to deviseyour own style named foo, you first have to create a file PPRfoo.sty which will contain its definition. Refer topredefined styles for some examples and to Section 8.4.A word of caution: you are free to create a new style by modifying an existing one. In that case, it is MANDA-TORY renaming your file; do NEVER EVER modify a style without renaming it (is that clear enough?). Youshould also write your name and email address in any of your styles such that users know who to get in touch withwhen they use the style. Please choose a name for your style that is unique in the prosper distribution (withrespect to both predefined and contributed styles so far).

Please send slide styles you are proud of. I will add them to the distribution in the contrib/ directory. Notethat I will only consider for addition styles that are indeed original. Modifying the colors or the fonts of an existingone is definitely not sufficient since this can be done by users in their LATEX file by using the provided hooks forcustomization.

8

Page 130: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

8.1 Predefined tests

The following tests may be used in your style file in order to modify its behaviour according to the active options.The general scheme is:

\ifxxxx%% The ‘‘then’’ part

\else%% The ‘‘else’’ part

\fi

\ifDVItoPS. True when the DVI file will be eventually translated into a PostScriptTM file, false when the finaltarget is the PDF format;

\ifisDraft. True when the file is compiled in draft mode;

\ifinColor. True when the option slideColor has been chosen;

\ifallPages. True when the option total has been chosen;

\ifcolorBG. True when the option colorBG has been chosen;

\ifshowVersion. True whenever the macro \displayVersion appears in the preamble;

\ifInOverlays. True if the current slide environment is embedded into an overlays macro.

8.2 Macros to customize or create a style

\slideCaptioncap. Definition of a caption to appear on every slide;

\PDFCroppingBoxlx ly ux uy. Definition of a PostScriptTM bounding box to crop slides for enhancingtheir appearance on 4/3 devices such as monitors (only used in PDF mode);

\NewSlideStyle[width]anchorposdefin. Defines a new slide style whose definition is givenby the macro \defin and whose contents area has width width and is put at position (pos) with anchoranchor. If no width is given, a default width of 11 cm is used;

\LogoPositionpos. Default position for a logo if none is given by the user;

\PutLogo. A macro to be put at the end of the macro that defines your own style.

8.3 Lengths

\slideWidth. Defines the width of the text area in the slide. Should not be modified by the user. Correspondsto the firth argument of macro NewSlideStyle.

8.4 Example: the troispoints style

\NeedsTeXFormatLaTeX2e[1995/12/01]\ProvidesPackagePPRtroispoints[2000/04/17]\typeout‘Trois points’ style for Prosper ---\typeout(c) 2000 Frederic Goualard, CWI, The Netherlands\typeoutCVSId: $Id: prosper-doc.tex,v 1.6 2000/12/05 14:56:48 exupery Exp $\typeout

\RequirePackageamssymb% Loading packages necessary to define this slide style.\IfFileExistspst-grad\RequirePackagepst-grad\RequirePackagegradient

\newgraymygrey.5

9

Page 131: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\newrgbcolormellow.847 .72 .525\newrgbcolororange1.00 0.65 0.00

\FontTitle%\usefontT1ptmmsl\fontsize22pt20pt\selectfont\orange%\usefontT1ptmmsl\fontsize22pt20pt\selectfont\blue

\FontText%\mellow\usefontT1phvmn\fontsize14.4pt14pt\selectfont%\black\usefontT1phvmn\fontsize14.4pt14pt\selectfont

\ColorFoot\mellow

% Positionning of the title of a slide.\newcommand\slidetitle[1]%\rput[l](-0.4,3.7)\parbox10cm\fontTitle#1

% Positionning for a logo\LogoPosition-1,-1.1

% Definition of this style for slides.

\newcommand\TPFrame[1]%\ifinColor\ifcolorBG\psframe[linestyle=none,fillstyle=solid,fillcolor=black](-2,-1.4)(12.5,9)\fi\fi\psframe[linestyle=dotted,dotsep=5pt,linewidth=2pt,linecolor=mellow]%(-1,-.5)(11.6,8.3)\pspolygon[linestyle=none,fillstyle=solid,%fillcolor=mygrey](8.4,8.4)(9.6,8.4)(9,7.4)\pspolygon[linestyle=none,fillstyle=solid,%fillcolor=red](8.2,8.5)(9.4,8.5)(8.8,7.5)\pspolygon[linestyle=none,fillstyle=solid,%fillcolor=mygrey](1.4,-1.1)(2.6,-1.1)(2,-.1)\pspolygon[linestyle=none,fillstyle=solid,%fillcolor=red](1.1,-.9)(2.3,-.9)(1.7,.1)\PutLogo % Mandatory#1

\NewSlideStylet5.3,2.9TPFrame\PDFCroppingBox10 40 594 800\RequirePackagesemhelv

\endinput

9 Copyright information

Copyright © 2000 by Frederic Goualard, all rights reserved.

Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify,and distribute this software and its documentation for any purpose, provided that the above copyright notice andthe following two paragraphs appear in all copies of this software.

IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE ANDITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCHDAMAGE.

10

Page 132: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.THE SOFTWARE PROVIDED HEREUNDER IS ON AN “AS IS” BASIS, AND THE AUTHOR HAS NO OBLI-GATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

10 The Prosper homepage

The official Prosper homepage is located at Source Forge (tm):

http://prosper.sourceforge.net/

You will find there additional information, CVS tarballs, news, up to date distributions of Prosper. . . If you planusing Prosper on a regular basis, you should consider subscribing to the lists prosper-users and prosper-announce. Directions to subscribe to them are available on the homepage.

Prosper is also available on the CTAN repository though the version there might sometimes be slightly out ofdate:

http://www.ctan.org/tex-archive/macros/latex/contrib/supported/prosper/

11 Troubleshootings

If you experience some problem when installing or using Prosper, please go first to the Prosper homepage to checkwhether there is some hint on how to solve it in one of the list archives. If you do not find any answer to yourproblem, send a mail to the prosper-users list. Only in the last resort should you send a mail directly to me.I am a subscriber of this list anyway, so I will certainly answer to you if nobody else does it.

There is also a file TROUBLESHOOTINGS in the distribution listing solutions to commonly encountered prob-lems.

Prosper relies on some recent versions of some packages and software (mainly hyperref and AladdinGhostScript). Check the homepage to find links to the required versions.

12 Bugs reports

Bugs are to be reported by filling the appropriate forms available at the Prosper homepage.

13 Getting in touch with the author

You can send me flames or praises at the following address.

[email protected]

You might find different email addresses scattered in some files of the distribution. However, you should notrely on them to get in touch with me since they are very likely to be out of date at the time you use them.

11

Page 133: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Indexaccumulate, 2\Accumulatefalse, 2\Accumulatetrue, 2\author, 3

Blinds, 1bounding box, 9Box, 1

colorBG, 2\ColorFoot, 4

\DefaultTransition, 3\displayVersion, 2, 3Dissolve, 1distiller, 2draft, 1

\email, 3

final, 2\FontText, 4\fontText, 4\FontTitle, 4\fontTitle, 4\FromSlide, 4\fromSlide, 2, 4

stared, 4

Glitter, 1GS OPTIONS, 8

\ifallPages, 9\ifcolorBG, 9\ifDVItoPS, 9\ifinColor, 9\ifInOverlays, 9\ifisDraft, 9\ifshowVersion, 9\institution, 3Itemize environment, 3itemize environment, 3itemstep environment, 3

\Logo, 3\LogoPosition, 9

\myitem, 4

NewSlideStyle, 9\NewSlideStyle, 9noaccumulate, 2nocolorBG, 2

\NoFrenchBabelItemize, 3nototal, 2

\onlyInPDF, 5\onlyInPS, 5\OnlySlide, 4\onlySlide, 2, 4

stared, 4\overlays, 4

\PAPERSIZE, 8\part, 3pdf, 2\PDFCroppingBox, 9\PDForPS, 5\PDFtransition, 4preamble, 3ps, 2\PutLogo, 9

Replace, 1

slidedisplay area, 5

slide environment, 2slideBW, 2\slideCaption, 2, 3, 9slideColor, 2\slideWidth, 9Split, 1\subtitle, 3

\title, 3total, 2transition

default, 3transitions

supported, 1

\UntilSlide, 4\untilSlide, 2, 4

stared, 4

Wipe, 1

12

Page 134: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

The PracTEX JournalTPJ 2005 No 04, 2005-10-20Article revision 2005-10-25

Beamer by ExampleAndrew Mertz and William Slough

Email eduedu, [email protected]@

Address Department of Mathematics and Computer ScienceEastern Illinois University600 Lincoln AvenueCharleston, IL 61920–3099

Abstract There are a variety of LATEX classes which can be used to produce “over-head slides” for presentations. One of these, beamer, provides flexible andpowerful environments which can be used to create slides and PDF-baseddocuments suitable for presentations. Although the class is extensively doc-umented, first-time users may prefer learning about this class using a col-lection of graduated examples. The examples presented here cover a widespectrum of use, from the simplest static slides to those with dynamic effects.

1 Introduction

LATEX users in search of a way to produce “overhead slides” for use with an LCD

projector have many choices today—perhaps too many! For example, MichaelWiedmann has a web site [7] that lists more than a dozen different tools, all LATEX-based, capable of producing PDF output.

For first-time users, it can be difficult to decide which of these many approachesbest matches their needs. In our experience, we have found the beamer class [6] tobe easy to use, flexible, and well documented.

The user’s guide for beamer is, of course, the ultimate authority for its use.However, at 203 pages, a potential user might be frightened off before having achance to experience its capabilities. Our intention here is to provide a samplingof beamer’s capabilities by displaying a variety of examples.

© 2005 Andrew Mertz and William Slough

Page 135: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

2 A first example

A beamer document consists of a sequence of overhead slides, known as frames. Inthe simplest case, a frame is the electronic equivalent of an overhead transparency.

Figure 1 gives a complete example of a beamer presentation, stored in a filenamed talk.tex. In the preamble, familiar LATEX commands appear. The bodyof the document specifies a title page is to appear, followed by two frames. Eachframe environment specifies the desired frame title and the contents to appear onthat frame.

Processing the talk.tex source with pdfLATEX yields talk.pdf, a PDF file suit-able for presentations. Figure 2 shows the resulting output.

Using this simple example as a template, a newcomer to beamer can producea wide variety of presentations—in effect by learning about just one new environ-ment, the frame.

3 Frame content

A frame can be subdivided into the following basic components, many of whichare optional:

• Head line and foot line

• Left and right sidebars

• Navigation bars

• Logo

• Frame title

• Background

• Content

In our examples, we use relatively few of these components, choosing to empha-size the content over the more decorative elements which are possible. Our firstexample does include a navigation bar located at the lower right hand corner ofthe frame, which is present by default.

2

Page 136: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\documentclassbeamer

\titleA Tiny Example

\authorAndrew Mertz and William Slough

\dateJune 15, 2005

\begindocument

\maketitle

\beginframe

\frametitleFirst Slide

Contents of the first slide

\endframe

\beginframe

\frametitleSecond Slide

Contents of the second slide

\endframe

\enddocument

Figure 1: Contents of our initial talk.tex.

3

Page 137: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

A Tiny Example

Andrew Mertz and William Slough

June 15, 2005

First Slide

Contents of the first slide

Second Slide

Contents of the second slide

Figure 2: The three output frames of talk.pdf.

4

Page 138: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

As far as frame content is concerned, most of the LATEX environments and com-mands work within beamer documents in the expected ways. So, for example, enu-merated and itemized lists, mathematics, and tables can all be expressed in waysfamiliar to LATEX users. The only thing different is that these commands must ap-pear within beamer’s frame environment. To illustrate, Figures 3 and 4 show howa table can be centered on a frame.

Frames containing verbatim text require special attention. Such frames mustbe marked as fragile. This is accomplished as follows:

\beginframe[fragile]

% ... frame contents ...

\endframe

To include graphics within a frame, facilities of the graphicx package may beused. Several points are worth noting related to graphics. To begin with, beamer

automatically loads the graphicx package, so no explicit \usepackage statement isneeded. For properly sizing graphics within a frame, it helps to know that beamer

formats its output to a size of 128 millimeters by 96 millimeters, or 5.04 inches by3.78 inches. The native graphics formats supported by pdfLATEX are JPEG, PNG,PDF, and MetaPost output.

Figures 5 and 6 illustrates how the graphics file named TeX-Zone.pdf can beplaced within a frame.

4 Frames with color

Emphasis in presentations may be obtained by changes in color, in addition to themore traditional font changes. Since beamer automatically loads the xcolor pack-age [3], colors can be specified using the syntax of xcolor. In particular, the “named”color model can be combined with a percentage using the xcolor ! specifier. Forexample,

\colorBlueViolet!30 A B C

will typeset the text “A B C” using the BlueViolet color, at 30% intensity.A particularly effective use of color can be applied to a tabular environment,

via the rowcolors command from xcolor. In this command, a starting row number

5

Page 139: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\beginframe

\frametitleFamous Composers

\begincenter

\begintabular|l|c|\hline

J.\ S.\ Bach & 1685--1750 \\

W.\ A.\ Mozart & 1756--1791 \\

L.\ Beethoven & 1770--1827 \\

F.\ Chopin & 1810--1849 \\

R.\ Schumann & 1810--1856 \\

B.\ Bart\’ok & 1881--1945 \\ \hline

\endtabular

\endcenter

\endframe

Figure 3: Source for a frame with a centered table.

Famous Composers

J. S. Bach 1685–1750W. A. Mozart 1756–1791L. Beethoven 1770–1827F. Chopin 1810–1849R. Schumann 1810–1856B. Bartok 1881–1945

Figure 4: Output produced by Figure 3.

6

Page 140: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\beginframe

\frametitleIncluding Graphics with Beamer

\begincenter

\includegraphics[height=3.0in]TeX-Zone

\endcenter

\endframe

Figure 5: Source for a frame with included graphics.

Including Graphics with Beamer

Figure 6: Output produced by Figure 5.

and two colors are specified. These two colors are used to alternately shade therows of a table, beginning with the given row. For example,

\rowcolors1RoyalBlue!20RoyalBlue!5

requests two shades of RoyalBlue are to be applied to a table, beginning with itsfirst row. This command should immediately precede the tabular environment,as shown in Figures 7 and 8.

To use color specifications like these within a beamer document, some addi-tional options must be given within the documentclass. Ordinarily, these colorcapabilities would be obtained with an appropriate \usepackage command.

7

Page 141: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\beginframe

\frametitleFamous Composers

\begincenter

\rowcolors1RoyalBlue!20RoyalBlue!5

\begintabular|l|c|\hline

J.\ S.\ Bach & 1685--1750 \\

W.\ A.\ Mozart & 1756--1791 \\

L.\ Beethoven & 1770--1827 \\

F.\ Chopin & 1810--1849 \\

R.\ Schumann & 1810--1856 \\

B.\ Bart\’ok & 1881--1945 \\ \hline

\endtabular

\endcenter

\endframe

Figure 7: Source for a frame containing a table with alternating colors.

Famous Composers

J. S. Bach 1685–1750W. A. Mozart 1756–1791L. Beethoven 1770–1827F. Chopin 1810–1849R. Schumann 1810–1856B. Bartok 1881–1945

Figure 8: Output produced by Figure 7.

8

Page 142: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

However, as mentioned earlier, beamer automatically loads xcolor (among oth-ers), thus making the usual command, \usepackagexcolor, both unnecessaryand illegal. What this means is that options we wish to specify for these packagesmust be given in a different way. This can be accomplished with beamer options.For example,

\documentclass[xcolor=pdftex,dvipsnames,table]beamer

specifies three different options to be used with the xcolor package. The first option,pdftex, provides information about the correct color driver to use. The optiondvipsnames allows a set of predefined color names, such as RoyalBlue, to be used.(These named colors are sometimes referred to as the “Crayola” colors.) Finally,the table option informs xcolor that the colortbl package needs to be loaded. It isthis last option that defines the \rowcolors command used in Figure 7.

5 Frames with two columns

Since frames have a landscape orientation, it can be helpful to be able to subdividea frame into two columns. The columns environment of beamer is designed to meetthis need.

Figures 9 and 10 provides an example of how a frame can be subdivided intotwo columns. The columns environment allows an alignment option which speci-fies whether columns are to be aligned along their top line, bottom line, or centered.In this example, the c option causes the two columns to be aligned along their ver-tical centers. Within the columns environment two columns appear, as specifiedwith the two \column commands.

6 Frames with dynamic effects

When using overhead projectors, speakers may choose to superimpose multipletransparencies in order to gradually build up a final image. In beamer, each com-ponent of this final image is known as an overlay.

Up to this point, the frames we have considered consisted of a single overlay.When the frame is displayed, everything on that frame appears at once.

9

Page 143: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\beginframe

\frametitleTwo Column Output

\begincolumns[c]

\column1.5in

Practical \TeX\ 2005\\

Practical \TeX\ 2005\\

Practical \TeX\ 2005

\column1.5in

\framebox\includegraphics[width=1.5in]p2005

\endcolumns

\endframe

Figure 9: Source for a double-column frame.

Two Column Output

Practical TEX 2005Practical TEX 2005Practical TEX 2005

Practical TEX 2005

Figure 10: Output produced by Figure 9.

10

Page 144: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Alternatively, a frame can consist of a sequence of overlays, which can be usedto support incremental display. Overlays can be used to “hold back” informationduring a presentation or to produce certain kinds of animated effects.

As a matter of taste, some people feel that a single overlay is preferable, sinceinformation is not hidden from the audience. However, we feel that there are situ-ations where multiple overlays are appropriate, especially when used judiciously.

The beamer class provides numerous ways to specify frames with multiple over-lays. We illustrate three techniques: using the \pause command, using overlayspecifications, and including multiple graphics files

Using the \pause command is a simple way to produce overlays. All text fromthe beginning of the frame to the place where a \pause command appears is for-matted and placed into an overlay. In this way, the example in Figure 11 creates aframe with three overlays. When the resulting PDF file is viewed, the three linesof output are incrementally revealed.

For this example, the command

\setbeamercovereddynamic

is in effect, so overlays not yet revealed will faintly appear. This allows the speakerto focus on the current overlay, yet not entirely hide information from the audi-ence.

Our second example of incremental display involves overlay specifications. Inbeamer, every overlay within a frame is assigned a number, starting with one, re-flecting the order in which they are displayed. An overlay specification describesa sequence of overlays and is denoted with angle brackets. For example, the

\beginframe

\frametitleOverlays with \tt pause

\setbeamercovereddynamic

Practical \TeX\ 2005\\ \pause

Practical \TeX\ 2005\\ \pause

Practical \TeX\ 2005

\endframe

Figure 11: Specifying multiple overlays with pause.

11

Page 145: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

specification <1,3,5> indicates overlays 1, 3, and 5 and <3-> describes all over-lays beginning with the third.

Figure 12 illustrates how a game of tic-tac-toe can be displayed. In this example,there are ten overlays—one for the grid, and one for each successive play in thegame.

The use of the syntax

\onslide<m->text

in Figure 12 indicates that the specified text is to appear on every overlay from monwards.

Initially, only the grid should appear, so no X or O appears on the first overlay.In this example, the first play is an X in the upper right-hand corner, so this Xappears on overlay 2 and every successive overlay. O counters by playing in thecenter, so this O appears on overlay 3 and every successive overlay. The rest of theexample follows in a similar way. In this situation, we do want to hide from viewoverlays not yet revealed, so the command

\setbeamercoveredinvisible

is appropriate. It is worth noting that beamer makes the overlay specification fea-ture available to other LATEX commands, such as \item.

For our third example of incremental effects, we use the facilities of the packagexmpmulti and a drawing tool which supports multiple layers. We use xfig, but manyother choices are possible.

Revisiting the game of tic-tac-toe, a grid can be drawn on layer 0, followed bythe first move on layer 1, the second move on layer 2, and so forth. After all layersof the drawing are complete, each layer is exported to a PDF file with a suffixwhich matches the layer number. For example, layer 0 is exported to game-0.pdf,layer 1 is exported to game-1.pdf and so forth. The \multiinclude command ofthe xmpmulti package, illustrated in Figure 13, causes the graphics files to appearas overlays.

In beamer, overlays are numbered beginning with 1, whereas xmpmulti consid-ers the first overlay to begin with 0.

12

Page 146: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

\beginframe

\frametitleTic-Tac-Toe via \tt tabular

\setbeamercoveredinvisible

\Huge

\begincenter

\begintabularc|c|c

\onslide<9->O & \onslide<8->X & \onslide<2->X \\ \hline

\onslide<6->X & \onslide<3->O & \onslide<5->O \\ \hline

\onslide<10->X & \onslide<7->O & \onslide<4->X

\endtabular

\endcenter

\endframe

Figure 12: Using overlay specifications.

\beginframe

\frametitleTic-Tac-Toe via Graphics Files

\setbeamercoveredinvisible

\begincenter

\multiinclude[format=pdf,width=3in]game

\endcenter

\endframe

Figure 13: Specifying multiple overlays with graphics files. The files to be includedare named game-0.pdf, game-1.pdf, . . ., game-9.pdf.

13

Page 147: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

7 Ornamental aspects

It is possible to “dress up” beamer presentations in a variety of ways. In Section 3,we noted that a frame includes a number of components, one of which is a foot line.Authors often employ a running foot line with their name, conference title, date,or some similar identification. In beamer, this can be accomplished by including acommand in the preamble, similar to the following:

\setbeamertemplatefootline[text line]A Sample Talk

As another example, one could use the Microsoft Comic Sans font, which canbe made available with the comicsans package [5]. Once this font has been estab-lished within the TEX system, adding the following two lines to the preamble ofthe beamer document will make it the default font:

\usepackagecomicsans

\renewcommand\sfdefaultcomic

A frame with the Comic Sans font is shown in Figure 14. Alternately, onemight choose to utilize the Arev Sans font [2] which is well suited for computerprojectors.

Another possibility is to choose from among the many different beamer themes.As an example, adding the following lines to the preamble of our beamer presenta-tion gives the title frame shown in Figure 15.

\usepackagebeamerthemesplit

\usethemeBerkeley

\usecolorthemedolphin

In addition to the visual appeal of themes, additional navigation tools are in-corporated in the frames based on the LATEX sections and subsections present inthe beamer presentation.

14

Page 148: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

Beamer by Example

Andrew MertzWilliam Slough

Mathematics and Computer Science DepartmentEastern Illinois University

June 15, 2005

Practical TEX 2005

Figure 14: Title frame composed with the Microsoft Comic Sans font.

Beamer byExample

AndrewMertzWilliamSlough Beamer by Example

Andrew MertzWilliam Slough

Mathematics and Computer Science DepartmentEastern Illinois University

June 15, 2005

Practical TEX 2005

Figure 15: Title frame composed with the Berkeley theme.

15

Page 149: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

8 Producing handouts

It is often desirable to produce a printed document which mirrors the content ofthe beamer presentation. There are two steps needed to accomplish this; first, createan overlay-free version of the presentation, and second, produce an N-up versionof the presentation.

Removing overlays from a beamer presentation is easily done within the pream-ble, by adding the handout option:

\documentclass[handout,xcolor=pdftex,dvipsnames,table]beamer

Processing a beamer document with this option causes all overlays for a givenframe to be collapsed into a single frame.

Once overlays have been removed, putting multiple frames onto a single sheetof paper is a separate problem related to PDF files. The pdfpages package [4],for example, solves this problem. For an automated approach based on the samepackage, pdfjam [1], a Unix shell script, can be used.

9 Conclusion

The contribution of many individuals in the LATEX community have made it possi-ble to produce overhead slides using typesetting standards of the highest quality.We are especially indebted to the work of Till Tantau and the other package de-signers cited earlier.

References

[1] David Firth. PDFjam. http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic/firth/software/pdfjam.

[2] Stephen G. Hartke. Arev Sans for TEX and LATEX.http://ctan.org/get?fn=/fonts/arev/doc/fonts/arev/arevdoc.pdf.

[3] Uwe Kern. Extending LATEX’s color facilities: the xcolor package.http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor.

16

Page 150: E:/F/Latex/CMU 12130610/Latex CMU 14150508/LaTeX2006 docwacharin/2301560/latex/CMU_LaTeX_2010_All.pdf · บทที่1 ขั้นตอนการลงโปรแกรม

[4] Andreas Matthias. The pdfpages package.http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/.

[5] Scott Pakin. The comicsans package.http://www.ctan.org/tex-archive/macros/latex/contrib/comicsans.

[6] Till Tantau. User’s Guide to the Beamer Class, Version 3.01.http://latex-beamer.sourceforge.net.

[7] Michael Wiedmann. Tools for Creating Screen or Online Presentations.http://www.miwie.org/presentations/presentations.html.

17