├── examples ├── shapes.png ├── example7.tex ├── example6.tex ├── example1.tex ├── example3.tex ├── myrefs.bib ├── example2.tex ├── example5.tex └── example4.tex ├── tutornotes.tex ├── online.cfg ├── handouts.tex ├── online.tex ├── slides.tex ├── README.markdown ├── make.bat ├── Makefile_non_silent ├── Makefile └── training.tex /examples/shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learnlatex/latex-beginners-course/HEAD/examples/shapes.png -------------------------------------------------------------------------------- /examples/example7.tex: -------------------------------------------------------------------------------- 1 | \documentclass{report} 2 | \usepackage{lipsum} 3 | \begin{document} 4 | \include{chapter1} 5 | \include{chapter2} 6 | \include{chapter3} 7 | \end{document} -------------------------------------------------------------------------------- /examples/example6.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{natbib} 4 | \bibliographystyle{plainnat} 5 | 6 | \begin{document} 7 | Main matter with citations such as \citet{lamport94}. 8 | 9 | \bibliography{myrefs} 10 | \end{document} 11 | -------------------------------------------------------------------------------- /examples/example1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,12pt]{article} 2 | % A comment in the preamble 3 | \begin{document} 4 | % This is a comment 5 | This is a simple 6 | document\footnote{with a footnote}. 7 | 8 | This is a new paragraph. 9 | \end{document} 10 | -------------------------------------------------------------------------------- /tutornotes.tex: -------------------------------------------------------------------------------- 1 | % ---------------------------------------------------------------------- 2 | % Tutor notes are a minor modification to handouts 3 | % ---------------------------------------------------------------------- 4 | 5 | \AtBeginDocument{\let\tutornote\marginpar} 6 | \input{handouts} -------------------------------------------------------------------------------- /online.cfg: -------------------------------------------------------------------------------- 1 | \Preamble{html} 2 | \begin{document} 3 | \CutAt{section} 4 | \Css 5 | {% 6 | div.obeylines-v 7 | { 8 | font-family: monospace; 9 | white-space: nowrap; 10 | text-align:left; 11 | clear:both; 12 | }% 13 | } 14 | \EndPreamble -------------------------------------------------------------------------------- /examples/example3.tex: -------------------------------------------------------------------------------- 1 | \documentclass{scrreprt} 2 | 3 | \title{A Sample Document} 4 | \author{Ann Author} 5 | 6 | \begin{document} 7 | \maketitle 8 | \tableofcontents 9 | 10 | \chapter{Introduction} 11 | 12 | This is a sample document with some dummy 13 | text\footnote{and a footnote}. 14 | 15 | \end{document} 16 | -------------------------------------------------------------------------------- /examples/myrefs.bib: -------------------------------------------------------------------------------- 1 | @inproceedings{smith05, 2 | author = "Smith, Jr, John and Jane Lucy Doe and Jo de Vere", 3 | title = "An example article", 4 | booktitle = "Proceedings of the Imaginary Society", 5 | month = JAN, 6 | year = 2005 7 | } 8 | 9 | @book{lamport94, 10 | author = "Leslie Lamport", 11 | title = "{\LaTeX} : a document preparation system", 12 | edition = "2nd", 13 | publisher = "Addison-Wesley", 14 | year = 1994 15 | } 16 | -------------------------------------------------------------------------------- /examples/example2.tex: -------------------------------------------------------------------------------- 1 | \documentclass{report} 2 | 3 | \usepackage{lipsum}% provides \lipsum to produce dummy text 4 | 5 | \title{My Thesis} 6 | \author{Ann Author} 7 | \date{July 2010} 8 | 9 | \begin{document} 10 | \maketitle 11 | 12 | \chapter{Introduction} 13 | 14 | This is a sample chapter. It includes some \emph{emphasise} 15 | and also some \textbf{bold} text. 16 | 17 | \section{Sample Section} 18 | 19 | This is a sample section with some dummy text to pad it out. \lipsum[1] 20 | 21 | \chapter{Method} 22 | 23 | This is another chapter with some more dummy text. \lipsum[1] 24 | 25 | \end{document} 26 | -------------------------------------------------------------------------------- /handouts.tex: -------------------------------------------------------------------------------- 1 | \documentclass[UKenglish]{article} 2 | 3 | \usepackage[noamsthm]{beamerarticle} 4 | \usepackage[hidelinks]{hyperref} 5 | 6 | % ---------------------------------------------------------------------- 7 | % New commands for article mode 8 | % ---------------------------------------------------------------------- 9 | \newcommand{\tutornote}[1]{} % Gobble timing notes 10 | 11 | \newtheorem{Example}{\translate{Example}} 12 | \newtheorem{Exercise}{\translate{Exercise}} 13 | \newenvironment<>{exercise}{\begin{Exercise}\mbox{}}{\end{Exercise}} 14 | \newenvironment<>{example} 15 | {\begin{Example}\nobreak\mbox{}\nobreak} 16 | {\end{Example}} 17 | 18 | \setbeamertemplate{alerted text begin}{} 19 | \setbeamertemplate{alerted text end}{} 20 | 21 | \setbeamertemplate{block begin}% 22 | {% 23 | \par 24 | \vskip\medskipamount 25 | {% 26 | \noindent 27 | \textbf{\insertblocktitle}% 28 | }% 29 | \par 30 | \nobreak % Addition to standard template 31 | \noindent 32 | \ignorespaces 33 | } 34 | 35 | % ---------------------------------------------------------------------- 36 | 37 | \input{training} -------------------------------------------------------------------------------- /examples/example5.tex: -------------------------------------------------------------------------------- 1 | \documentclass[oneside,numbers=noenddot]{scrbook} 2 | 3 | \usepackage{lipsum}% provides \lipsum to produce dummy text 4 | \usepackage{graphicx}% provides \includegraphics 5 | 6 | \titlehead{University of East Anglia\\ 7 | Norwich\\ 8 | NR15 1AJ} 9 | \subject{A thesis submitted for the degree of Doctor of Philosophy} 10 | \title{My Thesis} 11 | \author{Ann Author} 12 | \date{July 2010} 13 | \publishers{Prof.\ My Advisor} 14 | 15 | \begin{document} 16 | \maketitle 17 | 18 | \chapter{Introduction} 19 | 20 | This is a sample chapter with a figure and a reference to Chapter~\ref{ch:method}. 21 | 22 | \begin{figure}[htbp] 23 | \centering 24 | \includegraphics{shapes} 25 | \caption{Some Shapes} 26 | \end{figure} 27 | 28 | \section{Sample Section} 29 | 30 | This is a sample section with some dummy text to pad it out. \lipsum 31 | 32 | \chapter{Method}\label{ch:method} 33 | 34 | This is another chapter with a reference to Figure~\ref{fig:shapes} 35 | and some more dummy text. 36 | 37 | \begin{figure}[htbp] 38 | \centering 39 | \includegraphics[scale=0.5,angle=45]{shapes} 40 | \caption{A Sample Figure}\label{fig:shapes} 41 | \end{figure} 42 | 43 | \end{document} 44 | -------------------------------------------------------------------------------- /examples/example4.tex: -------------------------------------------------------------------------------- 1 | \documentclass[oneside]{scrbook} 2 | 3 | \usepackage{lipsum}% provides \lipsum to produce dummy text 4 | 5 | \titlehead{University of East Anglia\\ 6 | Norwich\\ 7 | NR15 1AJ} 8 | \subject{A thesis submitted for the degree of Doctor of Philosophy} 9 | \title{My Thesis} 10 | \author{Ann Author} 11 | \date{July 2010} 12 | \publishers{Prof.\ My Advisor} 13 | 14 | \begin{document} 15 | \maketitle 16 | 17 | \frontmatter 18 | \tableofcontents 19 | 20 | \chapter{Foreword} 21 | 22 | This is the foreword. It is in an unnumbered chapter. 23 | 24 | \mainmatter 25 | \chapter{Introduction} 26 | 27 | This is a sample chapter with a reference to Chapter~\ref{ch:method}. 28 | 29 | \section{Sample Section} 30 | 31 | This is a sample section with some dummy text to pad it out. \lipsum 32 | 33 | \chapter{Method}\label{ch:method} 34 | 35 | This is another chapter with some more dummy text. \lipsum 36 | 37 | \appendix % Switch to appendices 38 | 39 | \chapter{A Sample Appendix}\label{apd:sample} 40 | 41 | This is an appendix. \lipsum 42 | 43 | \chapter{Another Appendix} 44 | 45 | This is another appendix with a reference to Appendix~\ref{apd:sample}. 46 | \lipsum 47 | \end{document} 48 | -------------------------------------------------------------------------------- /online.tex: -------------------------------------------------------------------------------- 1 | \documentclass[english,UKenglish]{article} 2 | 3 | \usepackage[noamsthm]{beamerarticle} 4 | \usepackage{comment} 5 | \usepackage[pdfborder={0 0 0}]{hyperref} 6 | 7 | % ---------------------------------------------------------------------- 8 | % New commands for online mode 9 | % ---------------------------------------------------------------------- 10 | \newcommand{\tutornote}[1]{} % Gobble timing notes 11 | 12 | \newtheorem{Example}{\translate{Example}} 13 | \excludecomment{exercise} 14 | \newenvironment<>{example} 15 | {\begin{Example}\nobreak\mbox{}\nobreak} 16 | {\end{Example}} 17 | 18 | \setbeamertemplate{alerted text begin}{} 19 | \setbeamertemplate{alerted text end}{} 20 | 21 | % ---------------------------------------------------------------------- 22 | 23 | % Tikz and TeX4ht work together with the correct driver, but the 24 | % text in nodes needs to be simplified a bit 25 | \newcommand*{\pgfsysdriver}{pgfsys-tex4ht.def} 26 | \renewcommand{\shortstack}[1]{\begingroup\def\\{ }#1\endgroup} 27 | 28 | % At the same time, there is no sense in resizing graphics 29 | \AtBeginDocument{\renewcommand{\resizebox}[3]{#3}} 30 | 31 | % Using formatting in frame titles is a problem, so this is disabled 32 | \AtBeginDocument{\renewcommand{\pkg}[1]{#1}} 33 | 34 | \input{training} -------------------------------------------------------------------------------- /slides.tex: -------------------------------------------------------------------------------- 1 | \documentclass[english,UKenglish,ignorenonframetext]{beamer} 2 | 3 | % ---------------------------------------------------------------------- 4 | % Some simple settings for appearance in presentation mode 5 | % ---------------------------------------------------------------------- 6 | \definecolor{UEAblue}{RGB}{0,89,127} 7 | \definecolor{UEAgrey}{RGB}{153,139,125} 8 | \definecolor{UEAorange}{RGB}{215,128,25} 9 | 10 | \setbeamercolor{alerted text}{fg=UEAorange} 11 | \setbeamercolor{block title example}{fg=UEAblue} 12 | \setbeamercolor{structure}{fg=UEAblue} 13 | 14 | \setbeamercolor{author}{fg=UEAgrey} 15 | \setbeamercolor{institute}{fg=UEAgrey} 16 | \setbeamercolor{date}{fg=UEAgrey} 17 | \setbeamercolor{framesubtitle}{fg=UEAgrey} 18 | 19 | \setbeamerfont{author}{size=\large} 20 | \setbeamerfont{date}{size=\large} 21 | \setbeamerfont{example text}{series=\bfseries} 22 | \setbeamerfont{frametitle}{series=\bfseries,size=\large} 23 | \setbeamerfont{framesubtitle}{series=\mdseries,size=\large} 24 | \setbeamerfont{section}{series=\bfseries} 25 | \setbeamerfont{title}{series=\bfseries} 26 | \setbeamertemplate{navigation symbols}{} 27 | % ---------------------------------------------------------------------- 28 | 29 | \AtBeginSection[] % Do nothing for \section* 30 | { 31 | \begin{frame} 32 | \frametitle{Outline} 33 | \tableofcontents[currentsection] 34 | \end{frame} 35 | } 36 | 37 | \input{training} -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | LaTeX for Beginners 2 | =================== 3 | 4 | The [UK TeX Users' Group](http://uk.tug.org) periodically runs a course for new 5 | LaTeX users. The course notes and examples are here. 6 | 7 | There are three master documents: one to make the slides, one to make the 8 | handouts and one to make the tutor handouts, which include timings and other 9 | reminders. 10 | 11 | Using the slides 12 | ---------------- 13 | 14 | The slides are designed to cover the basic material of the course. We tend 15 | to add extra ideas in as the course runs. What seems appropriate depends on 16 | the group of students. 17 | 18 | Running a course 19 | ---------------- 20 | 21 | Experience suggests that the material here works well for a full day course. 22 | For this to work, the students need to have a computer already set up to 23 | use LaTeX. A full [TeX Live](http://tug.org/texlive) installation is probably 24 | the easiest way to go. 25 | 26 | The timing given in the tutor notes is approximate. Depending on the group, 27 | something like half an hour at the end of the day for general questions seems 28 | to work well. 29 | 30 | For Course Developers 31 | --------------------- 32 | 33 | If you are modifying this course and want to see possible errors, use 34 | 35 | make -f Makefile_non_silent 36 | 37 | rather than 38 | 39 | make 40 | 41 | 42 | Using this material 43 | ------------------- 44 | 45 | This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 46 | Unported License](http://creativecommons.org/licenses/by-sa/3.0/). 47 | 48 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Makefile for 'LaTeX for Beginners' materials 4 | 5 | if not [%1] == [] goto :init 6 | 7 | :help 8 | 9 | rem Default with no target is to give help 10 | 11 | echo. 12 | echo make all - make all targets 13 | echo make clean - clean out directory 14 | echo make handouts - make student handouts 15 | echo make online - make HTML version 16 | echo make notes - make tutor notes 17 | echo make slides - make slides 18 | echo. 19 | 20 | goto :EOF 21 | 22 | :init 23 | 24 | rem Avoid clobbering anyone else's variables 25 | 26 | setlocal 27 | 28 | set AUXFILES=4ct 4tc aux dvi idv lg log nav out snm tmp toc vrb xref 29 | set CLEAN=css gz html pdf png svg 30 | 31 | cd /d "%~dp0" 32 | 33 | :main 34 | 35 | if /i [%1] == [all] goto :all 36 | if /i [%1] == [clean] goto :clean 37 | if /i [%1] == [handouts] goto :handouts 38 | if /i [%1] == [online] goto :online 39 | if /i [%1] == [slides] goto :slides 40 | 41 | goto :help 42 | 43 | :all 44 | 45 | call make handouts online slides 46 | 47 | :clean 48 | 49 | for %%I in (%CLEAN%) do if exist *.%%I del /q *.%%I 50 | 51 | :clean-int 52 | 53 | for %%I in (%AUXFILES%) do if exist *.%%I del /q *.%%I 54 | 55 | goto :end 56 | 57 | :handouts 58 | 59 | call :pdf handouts 60 | 61 | goto :end 62 | 63 | :online 64 | 65 | htlatex online "online" 66 | 67 | goto :clean-int 68 | 69 | :notes 70 | 71 | call :pdf tutornotes 72 | 73 | goto :end 74 | 75 | :pdf 76 | 77 | echo "Typesetting %1" 78 | pdflatex -draftmode -interaction=nonstopmode %1 > nul 79 | if not ERRORLEVEL 1 ( 80 | pdflatex -interaction=nonstopmode %1 > nul 81 | ) 82 | goto :clean-int 83 | 84 | :slides 85 | 86 | call :pdf slides 87 | 88 | goto :end 89 | 90 | :end 91 | 92 | shift 93 | if not [%1] == [] goto :main -------------------------------------------------------------------------------- /Makefile_non_silent: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | ################################################################ 3 | # Makefile for 'LaTeX for Beginners' materials # 4 | ################################################################ 5 | ################################################################ 6 | 7 | #.SILENT: 8 | 9 | ################################################################ 10 | # Default with no target is to give help # 11 | ################################################################ 12 | 13 | help: 14 | @echo "" 15 | @echo " make all - make all targets" 16 | @echo " make clean - clean out directory" 17 | @echo " make handouts - make student handouts" 18 | @echo " make online - make HTML version" 19 | @echo " make notes - make tutor notes" 20 | @echo " make slides - make slides" 21 | @echo "" 22 | 23 | ############################################################## 24 | # Clean-up information # 25 | ############################################################## 26 | 27 | AUXFILES = \ 28 | 4ct \ 29 | 4tc \ 30 | aux \ 31 | dvi \ 32 | idv \ 33 | lg \ 34 | log \ 35 | nav \ 36 | out \ 37 | snm \ 38 | toc \ 39 | tmp \ 40 | vrb \ 41 | xref 42 | 43 | CLEAN = \ 44 | css \ 45 | gz \ 46 | html \ 47 | pdf \ 48 | png \ 49 | svg 50 | 51 | ################################################################ 52 | # Standard file options # 53 | ################################################################ 54 | 55 | %.pdf: %.tex 56 | NAME=`basename $< .tex` ; \ 57 | echo "Typesetting $$NAME" ; \ 58 | pdflatex -draftmode $< ; \ 59 | if [ $$? = 0 ] ; then \ 60 | pdflatex $< ; \ 61 | fi 62 | for I in $(AUXFILES) ; do \ 63 | rm -f *.$$I ; \ 64 | done 65 | 66 | ################################################################ 67 | # User make options # 68 | ################################################################ 69 | 70 | .PHONY = \ 71 | all \ 72 | clean \ 73 | handouts \ 74 | online \ 75 | notes \ 76 | slides 77 | 78 | all: handouts online notes slides 79 | 80 | clean: 81 | echo "Cleaning up" 82 | for I in $(AUXFILES) ; do \ 83 | rm -f *.$$I ; \ 84 | done 85 | for I in $(CLEAN) ; do \ 86 | rm -f *.$$I ; \ 87 | done 88 | 89 | handouts: handouts.pdf 90 | 91 | online: 92 | echo "Typesetting HTML" 93 | htlatex online "online" 94 | for I in $(AUXFILES) ; do \ 95 | rm -f *.$$I ; \ 96 | done 97 | 98 | notes: tutornotes.pdf 99 | 100 | slides: slides.pdf 101 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | ################################################################ 3 | # Makefile for 'LaTeX for Beginners' materials # 4 | ################################################################ 5 | ################################################################ 6 | 7 | .SILENT: 8 | 9 | ################################################################ 10 | # Default with no target is to give help # 11 | ################################################################ 12 | 13 | help: 14 | @echo "" 15 | @echo " make all - make all targets" 16 | @echo " make clean - clean out directory" 17 | @echo " make handouts - make student handouts" 18 | @echo " make online - make HTML version" 19 | @echo " make notes - make tutor notes" 20 | @echo " make slides - make slides" 21 | @echo "" 22 | 23 | ############################################################## 24 | # Clean-up information # 25 | ############################################################## 26 | 27 | AUXFILES = \ 28 | 4ct \ 29 | 4tc \ 30 | aux \ 31 | dvi \ 32 | idv \ 33 | lg \ 34 | log \ 35 | nav \ 36 | out \ 37 | snm \ 38 | toc \ 39 | tmp \ 40 | vrb \ 41 | xref 42 | 43 | CLEAN = \ 44 | css \ 45 | gz \ 46 | html \ 47 | pdf \ 48 | png \ 49 | svg 50 | 51 | ################################################################ 52 | # Standard file options # 53 | ################################################################ 54 | 55 | %.pdf: %.tex 56 | NAME=`basename $< .tex` ; \ 57 | echo "Typesetting $$NAME" ; \ 58 | pdflatex -draftmode -interaction=nonstopmode $< > /dev/null ; \ 59 | if [ $$? = 0 ] ; then \ 60 | pdflatex -interaction=nonstopmode $< > /dev/null ; \ 61 | fi 62 | for I in $(AUXFILES) ; do \ 63 | rm -f *.$$I ; \ 64 | done 65 | 66 | ################################################################ 67 | # User make options # 68 | ################################################################ 69 | 70 | .PHONY = \ 71 | all \ 72 | clean \ 73 | handouts \ 74 | online \ 75 | notes \ 76 | slides 77 | 78 | all: handouts online notes slides 79 | 80 | clean: 81 | echo "Cleaning up" 82 | for I in $(AUXFILES) ; do \ 83 | rm -f *.$$I ; \ 84 | done 85 | for I in $(CLEAN) ; do \ 86 | rm -f *.$$I ; \ 87 | done 88 | 89 | handouts: handouts.pdf 90 | 91 | online: 92 | echo "Typesetting HTML" 93 | htlatex online "online" > /dev/null 94 | for I in $(AUXFILES) ; do \ 95 | rm -f *.$$I ; \ 96 | done 97 | 98 | notes: tutornotes.pdf 99 | 100 | slides: slides.pdf -------------------------------------------------------------------------------- /training.tex: -------------------------------------------------------------------------------- 1 | % ---------------------------------------------------------------------- 2 | % Packages 3 | % ---------------------------------------------------------------------- 4 | \usepackage[T1]{fontenc} 5 | \usepackage{babel,booktabs,csquotes,lmodern,tikz,verbatim} 6 | % ---------------------------------------------------------------------- 7 | 8 | \usetikzlibrary{shapes} 9 | 10 | % ---------------------------------------------------------------------- 11 | % New commands for this document 12 | % ---------------------------------------------------------------------- 13 | \newcommand*{\BibTeX}{BibTeX} 14 | \newcommand*{\cls}[1]{\textsf{#1}} 15 | \newcommand*{\cs}[1]{\texttt{\textbackslash#1}} 16 | \newcommand*{\marg}[1]{\texttt{\{#1\}}} 17 | \newcommand*{\meta}[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}} 18 | \newcommand*{\oarg}[1]{\texttt{[#1]}} 19 | \newcommand*{\pkg}[1]{\textsf{#1}} 20 | 21 | \renewcommand*{\url}[1]{\href{http://#1}{\texttt{#1}}} 22 | 23 | \AtBeginDocument 24 | { 25 | \renewcommand*{\LaTeX}{LaTeX} 26 | \renewcommand*{\LaTeXe}{LaTeX2e} 27 | \renewcommand*{\TeX}{TeX} 28 | } 29 | % ---------------------------------------------------------------------- 30 | 31 | % ---------------------------------------------------------------------- 32 | % Meta-data 33 | % ---------------------------------------------------------------------- 34 | \title{\LaTeX{} Training Course} 35 | \subtitle{\enquote{Using \LaTeX{} to write a thesis}} 36 | \date{} 37 | \author{UK-TUG Volunteers} 38 | % ---------------------------------------------------------------------- 39 | 40 | \begin{document} 41 | 42 | \begin{frame} 43 | \titlepage 44 | \end{frame} 45 | 46 | \maketitle 47 | 48 | \tutornote{Time: 10:15} 49 | 50 | \tableofcontents 51 | 52 | \mode% 53 | { 54 | \begin{frame}{Outline} 55 | \tableofcontents 56 | \end{frame} 57 | } 58 | 59 | \section{An overview of \LaTeX{}} 60 | 61 | \begin{frame}{\LaTeX{} is a powerful system} 62 | 63 | \begin{itemize} 64 | \item \LaTeX{} can be used from a one page letter to a 1000~page 65 | textbook; 66 | \item Most of \emph{our} examples will be simple; 67 | \item Complex documents, for example interactive books and 68 | these slides, use the same ideas as we'll explore today; 69 | \item By separating input from output, reusing material becomes 70 | much easier. 71 | \end{itemize} 72 | 73 | \end{frame} 74 | 75 | \tutornote{Demo documents here} 76 | 77 | \begin{frame}{What is \LaTeX{}, and what is \TeX{}?} 78 | 79 | \begin{itemize} 80 | \item \TeX{} is a typesetting application; 81 | \item \TeX{} uses \emph{primitives} to determine how to put text 82 | on a page; 83 | \item For most practical purposes, we need a \emph{format} built 84 | on top of \TeX{}, for example: 85 | \begin{itemize} 86 | \item Plain \TeX{}; 87 | \item \LaTeX{}; 88 | \item Con\TeX{}t; 89 | \end{itemize} 90 | \item You can think of \LaTeX{} as an interpreter between you and 91 | \TeX{}. 92 | \end{itemize} 93 | 94 | \end{frame} 95 | 96 | \begin{frame}{\TeX{} \enquote{engines}} 97 | 98 | \begin{block}{pdf\TeX{}} 99 | The standard binary program: we'll be using this today. 100 | \end{block} 101 | 102 | \begin{block}{Xe\TeX{}} 103 | A merger of \TeX{} with modern font technology with support 104 | for native Unicode input and bidirectional typesetting. 105 | \end{block} 106 | 107 | \begin{block}{Lua\TeX{}} 108 | Also a modern engine: integrates the Lua scripting into \TeX{}. 109 | \end{block} 110 | 111 | \end{frame} 112 | 113 | \begin{frame}{What do we need to use \LaTeX{}?} 114 | 115 | \begin{itemize} 116 | \item A \TeX{} distribution: \TeX{} Live (Windows, Mac, Linux) or 117 | MiK\TeX{} (Windows only); 118 | \item A text editor, \emph{e.g.}~Notepad, TextEdit, Emacs; 119 | \item A PDF viewer, for example Adobe Reader. 120 | \end{itemize} 121 | 122 | \pause 123 | 124 | Usually, we use a specialist editor 125 | \begin{itemize} 126 | \item Coloured syntax; 127 | \item Buttons or menus to run \LaTeX{}, \emph{etc.}; 128 | \item Most include an integrated spell checker. 129 | \end{itemize} 130 | \end{frame} 131 | 132 | \tutornote{Time: 10:30} 133 | 134 | \section{Getting started} 135 | 136 | \begin{frame}{\LaTeX{} is not a word processor} 137 | 138 | \begin{itemize} 139 | \item \LaTeX{} input is stored as plain text files, usually with 140 | the extension \texttt{.tex}; 141 | \item \LaTeX{} input files contain both the text of the document 142 | and \emph{commands}; 143 | \item Commands start with a backslash, so look like this: 144 | \cs{example}; 145 | \item Writing in \LaTeX{} is therefore a bit like \emph{programming} 146 | it to produce the document you want; 147 | \item \emph{Logical} mark up is important in \LaTeX{}: we'll use some 148 | almost straight away! 149 | \end{itemize} 150 | 151 | \end{frame} 152 | 153 | \begin{frame}{Workflow} 154 | 155 | \resizebox{\linewidth}{!}{% 156 | \begin{tikzpicture}[ 157 | minimum width = 1.5 cm, 158 | minimum height = 1.5 cm, 159 | inner sep = 0.1 em, 160 | thick 161 | ] 162 | \path (0,0) node[draw] (edit) {\shortstack{Edit\\\texttt{.tex}\\File}} ; 163 | \path (3.5,0) node[draw,diamond] (errors) 164 | {\shortstack{Any\\Errors?}}; 165 | \path (7,0) node[draw] (pdf) {\shortstack{View\\PDF}}; 166 | \path (10.5,0) node[draw,diamond] (change) 167 | {\shortstack{Any\\Changes?}}; 168 | \path (14,0) node[draw] (done) {Done}; 169 | \draw[->] (edit) -- (errors) node[midway,above=-1em] 170 | {\LaTeX{}}; 171 | \draw[->] (errors) -- ++(0,-2) node[midway,right=-1em] 172 | {Yes} -| (edit); 173 | \draw[->] (errors) -- (pdf) node[midway,above=-1em] {No}; 174 | \draw[->] (pdf) -- (change); 175 | \draw[->] (change) -- ++(0,-2.5) node[midway,right=-1em] 176 | {Yes} -| (edit); 177 | \draw[->] (change) -- (done) node[midway,above=-1em] {No}; 178 | \end{tikzpicture} 179 | } 180 | 181 | \end{frame} 182 | 183 | \begin{frame}[fragile]{Spacing} 184 | 185 | \begin{itemize} 186 | \item \LaTeX{} treats multiple spaces as a single space; 187 | \item By default, the space between sentences is slightly larger 188 | than the space between words -- can be switched off using 189 | \cs{frenchspacing}; 190 | \item The tilde (\verb|~|) is used to create a non-breaking space; 191 | \item New line characters are treated as a space; 192 | \item Paragraph breaks should be indicated by a blank line; 193 | \item \LaTeX{} automatically indents paragraphs, except for the 194 | first paragraph after a section heading. 195 | \end{itemize} 196 | 197 | \end{frame} 198 | 199 | \begin{frame}[fragile]{A simple document} 200 | \begin{block}{Example} 201 | \begin{semiverbatim} 202 | \alert<2>{\\documentclass}\alert<2,4>{[a4paper,12pt]}\alert<2-3>{\{article\}} 203 | \alert<5>{\% A comment in the preamble} 204 | \alert<6>{\\begin\{document\}} 205 | \alert<7>{\% This is a comment} 206 | \alert<8>{This is a simple} 207 | \alert<8>{document\alert<9>{\\\alert<10>{footnote}\{\alert<11>{with a footnote}\}}.} 208 | 209 | \alert<8>{This is a new paragraph.} 210 | \alert<6>{\\end\{document\}} 211 | \end{semiverbatim} 212 | \end{block} 213 | 214 | \end{frame} 215 | 216 | \tutornote{Show demo document in \TeX{}works, and mention Sync\TeX{}} 217 | 218 | \begin{exercise} 219 | Use the editor of your choice to create the above document. While you 220 | can use a specialist editor, start by doing this example in a basic 221 | editor such as Notepad. Save the document with a \texttt{.tex} 222 | extension, for example \texttt{exercise1.tex}, then go to a 223 | Terminal/Command Prompt and type: 224 | \begin{verbatim} 225 | pdflatex exercise1 226 | \end{verbatim} 227 | You can then view the resulting PDF file using a PDF viewer such as 228 | Adobe Reader. 229 | 230 | Try experimenting with white space: what do multiple spaces and 231 | multiple lines do? Also try out using the tilde (\verb"~") for 232 | a non-breaking space and \cs{,} for spaces of different 233 | widths. 234 | 235 | \LaTeX{} automatically indents new paragraphs: see what the \cs{noindent} 236 | macro does to these cases. 237 | \end{exercise} 238 | 239 | \tutornote{Finish exercise at 10:50} 240 | 241 | \section{Logical structure} 242 | 243 | \begin{frame}[fragile]{Logical mark up} 244 | 245 | \LaTeX{} provides us with logical mark up, as well as the ability to 246 | directly set the appearance. 247 | \begin{block}{Logical mark up} 248 | \cs{emph}\marg{\meta{text}}\\ 249 | \marg{\cs{large} \meta{text}} 250 | \end{block} 251 | \begin{block}{Appearance mark up} 252 | \cs{textit}\marg{\meta{text}}\\ 253 | \marg{\cs{fontsize}\marg{12 pt}\marg{14 pt}\cs{selectfont} \meta{text}} 254 | \end{block} 255 | Usually, logical mark up is best when it is available. 256 | 257 | \end{frame} 258 | 259 | \begin{frame}{Title Page} 260 | 261 | First, you need to give the \enquote{meta-data}: 262 | \begin{itemize} 263 | \item \cs{title}\marg{\meta{title}} 264 | \item \cs{author}\marg{\meta{author(s)}} 265 | \item \cs{date}\marg{\meta{date}} (optional) 266 | \end{itemize} 267 | Then use \cs{maketitle} to display the title page. 268 | 269 | \end{frame} 270 | 271 | \begin{frame}{Sectioning commands} 272 | 273 | \begin{itemize} 274 | \item 275 | \alert<2>{\cs{chapter}\oarg{\meta{short title}}\marg{\meta{title}}} 276 | \item \cs{section}\oarg{\meta{short title}}\marg{\meta{title}} 277 | \item \cs{subsection}\oarg{\meta{short title}}\marg{\meta{title}} 278 | \item \cs{subsubsection}\oarg{\meta{short title}}\marg{\meta{title}} 279 | \item 280 | \alert<3>{\cs{paragraph}\oarg{\meta{short title}}\marg{\meta{title}}} 281 | \item \cs{subparagraph}\oarg{\meta{short title}}\marg{\meta{title}} 282 | \end{itemize} 283 | 284 | \end{frame} 285 | 286 | \begin{exercise} 287 | Try producing the following document. 288 | \verbatiminput{examples/example2} 289 | 290 | Experiment with the logical mark up for appearance, for example 291 | \cs{emph}, \cs{large}, \cs{Large} and \cs{Huge}. Compare these 292 | with the direct changes brought about by \cs{textit} and \cs{textbf}. 293 | 294 | Try changing the format of text for a longer block by trapping the 295 | formatting changes within \cs{begingroup} and \cs{endgroup}, for 296 | example 297 | \begin{verbatim} 298 | \begingroup 299 | \large 300 | \itshape 301 | Some text 302 | 303 | A second paragraph 304 | \endgroup 305 | \end{verbatim} 306 | 307 | \end{exercise} 308 | 309 | \begin{frame}[fragile]{Lists} 310 | 311 | \begin{block}{List with bullets, dashes, etc.} 312 | \begin{verbatim} 313 | \begin{itemize} 314 | \item This is an unordered list 315 | \end{itemize} 316 | \end{verbatim} 317 | \end{block} 318 | 319 | \begin{block}{List with numbered items} 320 | \begin{verbatim} 321 | \begin{enumerate} 322 | \item This is the first item. 323 | \item This will have number 2! 324 | \end{enumerate} 325 | \end{verbatim} 326 | \end{block} 327 | 328 | \end{frame} 329 | 330 | \begin{exercise} 331 | Make some lists, and nest one list inside another. How does the 332 | format of the numbers or markers change? You can only go to 333 | four levels with standard \LaTeX{}, but more than four nestings 334 | tends to be a bad sign anyway! 335 | \end{exercise} 336 | 337 | \tutornote{Finish exercise at 11:30} 338 | 339 | \section{Classes} 340 | 341 | \begin{frame}{Document classes} 342 | 343 | The \emph{document class} sets up the general layout of the document, 344 | for example: 345 | \begin{itemize} 346 | \item the format of the headings; 347 | \item if the document should have chapters; 348 | \item if the title should be on a separate page or above 349 | the text on the first page; 350 | \end{itemize} 351 | They can also add new control sequences. 352 | 353 | \begin{block}{Usage} 354 | \cs{documentclass}\oarg{\meta{options}}\marg{\meta{class-name}} 355 | \end{block} 356 | \end{frame} 357 | 358 | \begin{frame}{Base classes} 359 | 360 | \begin{description} 361 | \item[\cls{article}] for short documents without chapters; 362 | \item[\cls{report}] for longer documents with chapters, 363 | typically single-sided with an abstract; 364 | \item[\cls{book}] for books, typically double-sided with 365 | front matter and back matter; 366 | \item<2->[\cls{letter}] for correspondence; 367 | \item<2->[\cls{slides}] for presentations. 368 | \end{description} 369 | 370 | \end{frame} 371 | 372 | \begin{frame}{Modern classes} 373 | 374 | \begin{description} 375 | \item[\cls{KOMA-Script}] \cls{scrartcl}, \cls{scrreprt} 376 | and \cls{scrbook} to replace \cls{article}, \cls{report} 377 | and \cls{book}, respectively; 378 | \item[\cls{memoir}] replaces \cls{book} and \cls{report}; 379 | \item[\cls{beamer}] for slides (used to create the course 380 | material). 381 | \end{description} 382 | 383 | \end{frame} 384 | 385 | \begin{frame}[fragile]{KOMA-Script Example} 386 | 387 | \verbatiminput{examples/example3} 388 | 389 | \end{frame} 390 | 391 | \begin{frame}{Documentation} 392 | 393 | \begin{block}{On your computer} 394 | The \texttt{texdoc} application will show documentation for 395 | material you have installed. From the Command Prompt/Terminal 396 | \begin{center} 397 | \texttt{texdoc \meta{name}} 398 | \end{center} 399 | \end{block} 400 | 401 | \begin{block}{Online} 402 | Try CTAN: 403 | \begin{center} 404 | \texttt{http://ctan.org/pkg/\meta{name}} 405 | \end{center} 406 | or \texttt{texdoc} online 407 | \begin{center} 408 | \texttt{http://texdoc.net/pkg/\meta{name}} 409 | \end{center} 410 | \end{block} 411 | 412 | \end{frame} 413 | 414 | \begin{exercise} 415 | Try creating the above document. The KOMA-Script classes have 416 | various options that affect the document's appearance. Try 417 | experimenting with some of the following: \texttt{chapterprefix}, 418 | \texttt{headings=small}, \texttt{headings=normal}, 419 | \texttt{headings=big}, \texttt{numbers=enddot}, 420 | \texttt{numbers=noenddot}. For example: 421 | \begin{verbatim} 422 | \documentclass[chapterprefix]{scrreprt} 423 | \end{verbatim} 424 | 425 | Also try making simple documents with \textsf{memoir}: 426 | see how without any other changes the appearance of the PDF 427 | file is altered. 428 | 429 | To add some \enquote{dummy text} to your files, put the line 430 | \verb"\usepackage{lipsum}" before \verb"\begin{document}", then 431 | put \cs{lipsum} somewhere after \verb"\begin{document}". This 432 | will create a number of filler paragraphs. Use this to see what effect 433 | the \texttt{twocolumn} class option has on the layouts you see. 434 | 435 | Use \textsf{texdoc} to look up the documentation for the classes 436 | we are using. Some of these are very long: most of the time you only 437 | need a small subset of the commands available! 438 | \end{exercise} 439 | 440 | \section{Cross-referencing} 441 | 442 | \begin{frame}[fragile]{Cross-referencing} 443 | 444 | \begin{block}{Example input} 445 | \begin{verbatim} 446 | \section{A section} 447 | \label{sec:interesting} 448 | ... 449 | \ref{sec:interesting} 450 | \end{verbatim} 451 | \end{block} 452 | 453 | \emph{Two} \LaTeX{} runs are needed to get cross-references right. 454 | 455 | \end{frame} 456 | 457 | \tutornote{Mention \textsf{cleveref}} 458 | 459 | \begin{exercise} 460 | Try producing the following document. 461 | \verbatiminput{examples/example4} 462 | 463 | Experiment with cross-references to sections, subsections and items in 464 | ordered lists. Can you see how it works? 465 | \end{exercise} 466 | 467 | \tutornote{Finish exercise at 12:30 and go to lunch. Restart at 13:15.} 468 | 469 | \section{More logical structure} 470 | 471 | \begin{frame}[fragile]{Mathematics} 472 | 473 | \begin{itemize} 474 | \item Mathematical content is marked up in \LaTeX{} in a logical way; 475 | \item You can use \$ \ldots \$ or \cs{(} \ldots \cs{)} to mark up 476 | in-line maths; 477 | \item For displayed mathematics, use \cs{[} \ldots \cs{]}; 478 | \item A lot of spacing is automatic in math mode; 479 | \item Maths is an entire area on its own! 480 | \end{itemize} 481 | 482 | \begin{block}{Example input} 483 | \verb"\( y = 2 \sin \theta^2 \)" 484 | \end{block} 485 | 486 | \begin{block}{Example output} 487 | \( y = 2 \sin \theta^2 \) 488 | \end{block} 489 | 490 | \end{frame} 491 | 492 | \tutornote{Mention AMS material and Vo{\ss}'s \emph{Math Mode}} 493 | 494 | \begin{frame}{Creating your own commands} 495 | 496 | \begin{block}{Syntax} 497 | \cs{newcommand*}\marg{\cs{\meta{name}}}\marg{\meta{replacement text}}\\ 498 | \cs{newcommand*}\marg{\cs{\meta{name}}}\oarg{\meta{number}}% 499 | \marg{\meta{replacement text}}\\ 500 | \end{block} 501 | 502 | \begin{block}{Examples} 503 | \cs{newcommand*}\marg{\cs{authorname}}\marg{Joseph Wright} \\ 504 | \cs{newcommand*}\marg{\cs{important}}\oarg{1}\marg{\cs{textbf}\marg{\#1}} 505 | \end{block} 506 | 507 | \end{frame} 508 | 509 | \begin{exercise} 510 | Create some simple mathematical content (for example \verb"y = mx + c") 511 | and compare the effect of \cs{(} \ldots \cs{)} with \cs{[} \ldots \cs{]}. 512 | Can you work out how to get capitalised Greek letters? Can you 513 | guess why some Greek do not seem to work? 514 | 515 | Subscripts and superscripts in math mode are created using \verb"_" 516 | and \verb"^", respectively. Try these out, and think about why you 517 | might use \cs{textsuperscript} rather than \verb"^" in some cases. 518 | 519 | Try creating your own simple commands using \cs{newcommand}. Think of 520 | how to create commands using 1, 2 and 3 arguments. 521 | \end{exercise} 522 | 523 | \tutornote{Finish exercise at 13:45.} 524 | 525 | \section{Floating material} 526 | 527 | \begin{frame}[fragile]{On packages} 528 | 529 | The \LaTeX{} kernel is rather limited: to get around that we 530 | load \emph{packages}: 531 | \begin{semiverbatim} 532 | \cs{usepackage}\oarg{\meta{options}}\marg{\meta{package}} 533 | \end{semiverbatim} 534 | or 535 | \begin{semiverbatim} 536 | \cs{usepackage}\texttt{\{\meta{package1},\meta{package2},\ldots\}} 537 | \end{semiverbatim} 538 | We have already seen the \pkg{lipsum} package! 539 | 540 | \vspace{1 em} 541 | 542 | \uncover<2>{% 543 | Documentation for packages is available in exactly the same way 544 | as for classes.% 545 | } 546 | 547 | \end{frame} 548 | 549 | \begin{frame}[fragile]{Including external images} 550 | 551 | \begin{itemize} 552 | \item Load the \pkg{graphicx} package to include graphics; 553 | \item Use \cs{includegraphics} to actually place the image; 554 | \item Image formats: \texttt{pdf}, \texttt{png}, \texttt{jpg}; 555 | \item Images in \texttt{eps} format \enquote{auto-converted} to 556 | \texttt{pdf}; 557 | \item File extension should be omitted. 558 | \end{itemize} 559 | 560 | \vspace{1 em} 561 | \uncover<2>{% 562 | Graphics can also be \enquote{drawn} in \LaTeX{} using the 563 | Ti\emph{k}Z package:\\ a course in itself! 564 | } 565 | 566 | \end{frame} 567 | 568 | \tutornote{Perhaps include keyval interface for graphics options} 569 | 570 | \begin{frame}[fragile]{Floating figures} 571 | 572 | \begin{block}{A floating figure \dots} 573 | \begin{semiverbatim} 574 | \\begin\{figure\}\alert<2>{[htbp]} 575 | \alert<3>{\\centering} 576 | \\includegraphics\{myimage\} 577 | \alert<4>{\\caption\{A Sample Figure\}} 578 | \alert<5>{\\label\{fig:sample\}} 579 | \\end\{figure\} 580 | \end{semiverbatim} 581 | \end{block} 582 | 583 | \begin{block}<6->{\ldots needs a cross-reference} 584 | \begin{semiverbatim} 585 | as is show in Figure~\alert<6>{\\ref\{fig:sample\}} 586 | \end{semiverbatim} 587 | \end{block} 588 | 589 | \end{frame} 590 | 591 | \begin{exercise} 592 | Try producing the following document. (Use an image application, 593 | such as Paint, to produce a simple picture and save it as 594 | \texttt{shapes.png}.) 595 | \verbatiminput{examples/example5} 596 | Here are some more class options to try that will affect the list of 597 | figures: \texttt{chapteratlists}, \texttt{chapteratlists=0mm}. 598 | \end{exercise} 599 | 600 | \begin{frame}{Tables} 601 | 602 | \begin{itemize} 603 | \item The floating environment for a table is called \texttt{table}; 604 | \item However, the content can be anything! 605 | \item Use the \texttt{tabular} environment to make tables; 606 | \item Load the \textsf{booktabs} package for rules. 607 | \end{itemize} 608 | 609 | \end{frame} 610 | 611 | \begin{frame}[fragile]{Tables} 612 | 613 | \begin{block}{A simple table} 614 | \begin{semiverbatim} 615 | \alert<2>{\\begin\{table\}} 616 | \alert<2>{\\centering} 617 | \alert<2>{\\caption\{A caption\}} 618 | \alert<2>{\\label\{tab:example\}} 619 | \alert<3>{\\begin\{tabular\}}\alert<4>{\{lcr\}} 620 | \alert<5>{\\toprule} 621 | Heading \alert<6>{&} Another one \alert<6>{&} A third \alert<7>{\\\\} 622 | \alert<5>{\\midrule} 623 | a \alert<6>{&} b \alert<6>{&} c \alert<7>{\\\\} 624 | d \alert<6>{&} e \alert<6>{&} f \alert<7>{\\\\} 625 | \alert<8>{\\multicolumn\{3\}\{c\}\{Wide text\}} \alert<7>{\\\\} 626 | \alert<5>{\\bottomrule} 627 | \alert<3>{\\end\{tabular\}} 628 | \alert<2>{\\end\{table\}} 629 | \end{semiverbatim} 630 | \end{block} 631 | 632 | \end{frame} 633 | 634 | \begin{exercise} 635 | 636 | Use the simple table example to start experimenting with tables. 637 | Try out different alignments using the \texttt{l}, \texttt{c} and 638 | \texttt{r} column types. What happens if you have too few items 639 | in a table row? How about too many? Experiment with the 640 | \cs{multicolumn} command to span across columns. 641 | 642 | \end{exercise} 643 | 644 | \tutornote{Finish exercise at 14:45.} 645 | 646 | \section{Bibliographies} 647 | 648 | \begin{frame}{Creating a bibliography} 649 | 650 | \begin{itemize} 651 | \item Entries are stored in a \emph{\BibTeX{} database}; 652 | \item Inform \LaTeX{} about it using \cs{bibliography} command; 653 | \item These are cited using \cs{cite} in the \LaTeX{} file; 654 | \item Choose a style using \cs{bibliographystyle}. 655 | \end{itemize} 656 | 657 | \end{frame} 658 | 659 | \begin{frame}[fragile]{Creating a bibliography}{The \LaTeX{} basics} 660 | 661 | \begin{verbatim} 662 | \documentclass{article} 663 | \usepackage{natbib} 664 | \bibliographystyle{plainnat} 665 | \begin{document} 666 | Some text \cite{key}. 667 | \bibliography{example} 668 | \end{document} 669 | \end{verbatim} 670 | 671 | \end{frame} 672 | 673 | \begin{frame}{\BibTeX{} workflow} 674 | 675 | \small\mode
{\footnotesize} 676 | \resizebox{\linewidth}{!}{% 677 | \begin{tikzpicture}[thick] 678 | \begin{scope}[minimum width=1.5cm,minimum height=1.5cm,inner sep=.1em] 679 | \path (0,0) node[draw] (edit) {\shortstack{Edit\\\texttt{.tex}\\File}}; 680 | \path (0,2) node[draw] (editbib) {\shortstack{Edit\\\texttt{.bib}\\File}}; 681 | \path (3.2,1) node[draw,diamond] (errors) 682 | {\shortstack{Any\\Errors?}}; 683 | \path (6.8,1) node[draw,diamond] (bibtexerrors) 684 | {\shortstack{Any\\Errors?}}; 685 | \path (10,1) node[draw,diamond] (errors2) 686 | {\shortstack{Any\\Errors?}}; 687 | \path (12.5,1) node[draw] (pdf) {\shortstack{View\\PDF}}; 688 | \end{scope} 689 | \path (8.5,4.5) node[draw,rectangle] (rmbbl) {Remove \texttt{.bbl} file}; 690 | \draw[->] (edit) -- (1,1) -- (errors) node[midway,above] 691 | {\shortstack{\LaTeX{}\\\texttt{.tex} file}}; 692 | \draw (editbib) -- (1,1); 693 | \draw[->] (errors) -- ++(0,-2) node[midway,left] {Yes} 694 | -| (edit) node[pos=0,below,anchor=north east] 695 | {Error in document}; 696 | \draw[->] (errors) -- (bibtexerrors) 697 | node[midway,above] {\shortstack{No errors.\\Run \BibTeX{}}}; 698 | \draw[->] (bibtexerrors) -- ++(0,-2.75) 699 | node[midway,right] {Yes} -| (edit) 700 | node[pos=0,below,anchor=north east] 701 | {Misspelt/missing label or bib style}; 702 | \draw[->] (bibtexerrors) -- ++(0,2.75) node[midway,right] 703 | {Yes} -| (editbib) node[pos=0,above,anchor=south east] 704 | {Error in bib file}; 705 | \draw[->] (bibtexerrors) -- (errors2) node[midway,above] 706 | {\shortstack{No errors.\\Run \LaTeX{}\\(twice)}}; 707 | \draw[->] (errors2) |- (rmbbl) node[pos=0.2,right] {Yes}; 708 | \draw[->] (rmbbl) -| (editbib); 709 | \draw[->] (errors2) -- (pdf) node[midway,above] {No}; 710 | \end{tikzpicture}% 711 | } 712 | 713 | \end{frame} 714 | 715 | \begin{frame}[fragile]{The \BibTeX{} file}{A basic article} 716 | 717 | \begin{example} 718 | \begin{semiverbatim} 719 | \alert<2>{@book}\{\alert<3>{lamport94}, 720 | author = \{Leslie Lamport\}, 721 | title = 722 | \{\alert<4>{\{\\LaTeX\{\}\}}: a document preparation system\}, 723 | edition = \{2nd\}, 724 | publisher = \{Addison-{}-Wesley\}, 725 | year = \alert<5>{1994}, 726 | \} 727 | \end{semiverbatim} 728 | \end{example} 729 | 730 | \end{frame} 731 | 732 | \begin{frame}[fragile]{The \BibTeX{} file}{Multiple authors} 733 | 734 | \begin{example} 735 | \begin{semiverbatim} 736 | @inproceedings\{smith05, 737 | author = \{Smith, Jr, John \alert<2>{and} Jane Lucy Doe 738 | \alert<2>{and} Other, Andrew N. \alert<2>{and} de Vere, Jo\}, 739 | title = \{An example article\}, 740 | booktitle = \{Proceedings of the Imaginary Society\}, 741 | month = JAN, 742 | year = 2005 743 | \} 744 | \end{semiverbatim} 745 | \end{example} 746 | 747 | \end{frame} 748 | 749 | \begin{frame}[fragile]{Citations in \LaTeX{}} 750 | 751 | \begin{itemize} 752 | \item The \LaTeX{} kernel is limited for citations; 753 | \item The \pkg{natbib} package is much more powerful; 754 | \item A new approach is provided by \pkg{biblatex}. 755 | \end{itemize} 756 | 757 | \end{frame} 758 | 759 | \begin{frame}{Citations using \pkg{natbib}} 760 | 761 | \begin{block}{Textual citations} 762 | \vspace*{0.5 em} 763 | \begin{tabular}{l@{\ $\Rightarrow$\ }l} 764 | \multicolumn{2}{l}{% 765 | \cs{citet}\oarg{\meta{note}}\marg{\meta{key}}% 766 | } \\[0.5em] 767 | \cs{citet}\marg{lamport1994} & Lamport (1994) \\ 768 | \cs{citet}\oarg{p.\textasciitilde34}\marg{lamport1994} & 769 | Lamport (1994, p.~34) \\ 770 | \end{tabular} 771 | \end{block} 772 | 773 | \begin{block}{Parenthetical citations} 774 | \vspace*{0.5 em} 775 | \begin{tabular}{l@{\ $\Rightarrow$\ }l} 776 | \multicolumn{2}{l}{% 777 | \cs{citep}\oarg{\meta{prenote}}\oarg{\meta{postnote}}% 778 | \marg{\meta{key}}% 779 | } \\[0.5em] 780 | \cs{citep}\marg{lamport94} & (Lamport, 1994)\\ 781 | \cs{citep}\oarg{p.\textasciitilde34}\marg{lamport94} 782 | & (Lamport, 1994, p.~34)\\ 783 | \cs{citep}\oarg{see}\oarg{}\marg{lamport94} & (see Lamport, 1994) 784 | \end{tabular} 785 | \end{block} 786 | 787 | \end{frame} 788 | 789 | \begin{exercise} 790 | Create a file called \texttt{myrefs.bib} that contains the 791 | following: 792 | \verbatiminput{examples/myrefs.bib} 793 | 794 | Then create a file called, say, \texttt{example5.tex} that contains 795 | the following: 796 | \verbatiminput{examples/example6.tex} 797 | 798 | If you are using a terminal or command prompt, you will need to use 799 | the following commands: 800 | \begin{verbatim} 801 | pdflatex example5 802 | bibtex example5 803 | pdflatex example5 804 | pdflatex example5 805 | \end{verbatim} 806 | 807 | There are various options you can pass to the \pkg{natbib} package 808 | that affects the formatting. For example: 809 | \begin{verbatim} 810 | \usepackage[numbers,sort&compress]{natbib} 811 | \end{verbatim} 812 | Try experimenting with some of these options: \texttt{round}, 813 | \texttt{curly} and \texttt{numbers}. With the \texttt{numbers} 814 | option, you can also use: \texttt{super}, \texttt{sort} 815 | and \texttt{sort\&compress}. 816 | \end{exercise} 817 | 818 | \section{Long documents} 819 | 820 | \begin{frame}{Working with long documents} 821 | 822 | \begin{itemize} 823 | \item Long documents are best split into parts; 824 | \item \cs{input} places the material loaded \enquote{here}; 825 | \item \cs{include} is used for separate chapters:\\ it always starts 826 | a new page; 827 | \item Using \cs{include} allows you to \cs{includeonly}\\ 828 | selected chapters; 829 | \item Use \cs{includeonly} in the preamble. 830 | \end{itemize} 831 | 832 | \end{frame} 833 | 834 | \begin{exercise} 835 | 836 | Create a master file 837 | \verbatiminput{examples/example7.tex} 838 | along with the three chapters, each of which can be as simple as 839 | \begin{verbatim} 840 | \chapter{A demo} 841 | \lipsum 842 | \end{verbatim} 843 | Experiment with this basic structure, and using \cs{includeonly} to 844 | use only some of the files. 845 | 846 | \end{exercise} 847 | 848 | \tutornote{Finish exercise at 15:45 and break for coffee} 849 | 850 | \section{Further information} 851 | 852 | \begin{frame}{Getting help} 853 | 854 | \begin{itemize} 855 | \item \url{www.tex.ac.uk/faq}; 856 | \item \url{wwww.latex-community.org}; 857 | \item \url{tex.stackexchange.com}; 858 | \item \url{www.dickimaw-books.com/latexresources.html}; 859 | \item \url{detexify.kirelabs.org/}. 860 | \end{itemize} 861 | 862 | \end{frame} 863 | 864 | \begin{frame}{Reading} 865 | 866 | \begin{itemize} 867 | \item \emph{Not So Short Introduction to \LaTeXe{}}, Oetiker; 868 | \item \emph{A Guide to \LaTeX{}}, Kopka and Daly; 869 | \item \emph{\LaTeX{} for Complete Novices}, Talbot; 870 | \item \emph{\LaTeX{} and Friends}, van Dongen. 871 | \end{itemize} 872 | 873 | \end{frame} 874 | 875 | \tutornote{Time allowing, simple \textsf{hyperref} demo is good here} 876 | 877 | \end{document} 878 | 879 | --------------------------------------------------------------------------------