LaTeX Notes for Professionals (GoalKicker) (Z-Library)
Author: GoalKicker
非小说
No Description
📄 File Format:
PDF
💾 File Size:
1.4 MB
51
Views
0
Downloads
0.00
Total Donations
📄 Text Preview (First 20 pages)
ℹ️
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
📄 Page
1
LaTeX Notes for ProfessionalsLaTeX Notes for Professionals GoalKicker.com Free Programming Books Disclaimer This is an unocial free book created for educational purposes and is not aliated with ocial LaTeX group(s) or company(s). All trademarks and registered trademarks are the property of their respective owners 50+ pages of professional hints and tricks
📄 Page
2
Contents About 1 ................................................................................................................................................................................... Chapter 1: Getting started with LaTeX 2 .............................................................................................................. Section 1.1: LaTeX Editors 2 .............................................................................................................................................. Section 1.2: Installation and Setup 2 ............................................................................................................................... Chapter 2: Title Pages 7 ................................................................................................................................................ Section 2.1: Standard report titlepage 7 ......................................................................................................................... Chapter 3: Header and Footer 8 ............................................................................................................................... Section 3.1: Using fancyhdr and titleps packages 8 ...................................................................................................... Section 3.2: Page number as CurrPage/TotalPages in footer 9 ................................................................................. Chapter 4: Text Formatting 11 .................................................................................................................................. Section 4.1: Bold text 11 ................................................................................................................................................... Section 4.2: Emphazise Text 11 ....................................................................................................................................... Section 4.3: Strike through text 11 .................................................................................................................................. Chapter 5: Tables 12 ....................................................................................................................................................... Section 5.1: The tabular environment 12 ........................................................................................................................ Section 5.2: Coloring Table 13 ......................................................................................................................................... Chapter 6: Typesetting Mathematics 16 ............................................................................................................... Section 6.1: Basic Equations 16 ....................................................................................................................................... Section 6.2: Finding Symbols 17 ..................................................................................................................................... Section 6.3: Packages available for use 17 ................................................................................................................... Section 6.4: Good Commands to Know 18 .................................................................................................................... Section 6.5: Creating New Symbols 19 ........................................................................................................................... Section 6.6: Matrices 19 ................................................................................................................................................... Chapter 7: Creating a Bibliography 21 .................................................................................................................. Section 7.1: Basic bibliography with biber 21 ................................................................................................................. Section 7.2: Basic bibliography without packages (manual formatting) 22 .............................................................. Chapter 8: Add Citation 23 ........................................................................................................................................... Section 8.1: Add citation to already existing LaTeX document 23 .............................................................................. Chapter 9: Counters, if statements and loops with LaTeX 24 ................................................................... Section 9.1: Operations with counters 24 ....................................................................................................................... Section 9.2: Counter declaration, initialization and printing to pdf 25 ........................................................................ Section 9.3: If statements 25 ........................................................................................................................................... Section 9.4: Loops - repeating things 26 ........................................................................................................................ Section 9.5: Using loops in Tikz 28 .................................................................................................................................. Chapter 10: Document Classes 30 ............................................................................................................................ Section 10.1: Article 30 ...................................................................................................................................................... Section 10.2: Beamer 30 ................................................................................................................................................... Section 10.3: Defining the document class 31 ................................................................................................................ Chapter 11: Drawing Graphs 32 .................................................................................................................................. Section 11.1: TikZ -- Graph specifications 32 ................................................................................................................... Section 11.2: TikZ -- Algorithmic graph drawing 33 ....................................................................................................... Section 11.3: State Transition Diagram of a Markov Chain 34 ..................................................................................... Section 11.4: TikZ -- Manual layout 35 ............................................................................................................................ Chapter 12: Presentation with beamer package 37 ........................................................................................ Section 12.1: Simple one author title slide 37 ..................................................................................................................
📄 Page
3
Section 12.2: Multiple author and aliation title slide 38 .............................................................................................. Chapter 13: Defining macros 40 ................................................................................................................................. Section 13.1: Basic definition of macros 40 ..................................................................................................................... Chapter 14: Build Tools 41 ............................................................................................................................................ Section 14.1: Arara 41 ........................................................................................................................................................ Chapter 15: Accessing documentation of LaTeX packages 42 .................................................................. Section 15.1: CTAN 42 ........................................................................................................................................................ Section 15.2: TeX Live -- texdoc 44 ................................................................................................................................. Chapter 16: Creating posters using beamer 45 ................................................................................................. Section 16.1: Orientation and size 45 ............................................................................................................................... Section 16.2: Basic outline of a beamer poster 45 ........................................................................................................ Section 16.3: Full example of beamer poster 49 ............................................................................................................ Chapter 17: Engraving Sheet Music 54 ................................................................................................................... Section 17.1: LilyPond 54 ................................................................................................................................................... Credits 56 .............................................................................................................................................................................. You may also like 57 ........................................................................................................................................................
📄 Page
4
GoalKicker.com – LaTeX Notes for Professionals 1 About Please feel free to share this PDF with anyone for free, latest version of this book can be downloaded from: https://goalkicker.com/LaTeXBook This LaTeX Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA, see credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified This is an unofficial free book created for educational purposes and is not affiliated with official LaTeX group(s) or company(s) nor Stack Overflow. All trademarks and registered trademarks are the property of their respective company owners The information presented in this book is not guaranteed to be correct nor accurate, use at your own risk Please send feedback and corrections to web@petercv.com
📄 Page
5
GoalKicker.com – LaTeX Notes for Professionals 2 Chapter 1: Getting started with LaTeX Version Release Date LaTeX 2.09 1985-09-01 LaTeX 2e 1994-06-01 Section 1.1: LaTeX Editors While you can create LaTeX documents using any editor and compiling using the console, there exist several plugins for widely used editors to simplify creating LaTeX documents, and there are specialized LaTeX editors. An exhaustive list of LaTeX editors is available on TeX.SE (the StackExchange site, dedicated to TeX, LaTeX & Friends). The most widely used editors, according to this list, are: The Emacs editor with the AUCTeX extension. The Vim editor with the LaTeX-suite plugin. Texmaker – a specialized LaTeX IDE. TeXstudio – another LaTeX IDE. TeXworks – one more LaTeX IDE. While experienced users of Emacs or Vim may want to stick to their editor (whose plugins provide a host of functionality unavailable elsewhere), a specialized IDE might be easier to install/use for beginners. The last three on the list have a preview function where one can see the results of the compilation of the document. Additionally, there are online LaTeX tools that can be of use to beginners or people that must collaborate, e.g. ShareLaTeX and Overleaf. Section 1.2: Installation and Setup You can choose between major distributions of LaTeX: TeX Live (Windows, Linux, and OS X), the standard, cross-platform distribution. MacTeX (Mac) A packaged version of TeX Live made for OS X with some Mac-specific tools MiKTeX (Windows) A separate distribution entirely that All distributions are more or less equivalent in an ideal world. TeX Live has the advantage of being available on all platforms and thus has much better community support. MiKTeX can take advantage of Windows-specific features. For licensing reasons, MiKTeX will also distribute a few packages that TeX Live will not. In all cases, the full install is recommended. Specifically, using MiKTeX's download-on-command feature will hang/crash many editors. Installation Windows (TeXLive) Download the most recent TeXLive install-tl-windows.exe from their website.1. Run install-tl-windows.exe and follow the instructions.2. Windows (MiKTeX) Download the most recent MiKTeX installer from their website.1. Run the installer and follow the instructions.2. Mac OS X (TeXLive)
📄 Page
6
GoalKicker.com – LaTeX Notes for Professionals 3 Download the most recent MacTeX from their website.1. Run MacTeX.pkg and follow the instructions.2. Linux (TeXLive) Linux users have two options: Install via your distribution's package manager (usually several releases behind)1. Install from upstream (released yearly, updated often)2. Using Package Managers Arch Linux: pacman -S texlive-most Debian/Ubuntu/Mint: apt-get install texlive-full Fedora: yum install texlive Note that using this method means that you will be dependent on that package's maintainer for the distribution for updates. These packages will often be several releases behind the most recent distribution, often meaning critical updates will be missing. It's almost always best to install from upstream. Also note that the distribution's package manager will probably not recognize the direct installation and could try to install it when one installs other related support packages. Installing from Upstream Download the most recent TeXLive install-tl-unx.tar.gz from their website.1. Extract the files from the archive with tar -zxvf install-tl-unx.tar.gz.2. Change into the downloaded folder with cd install-tl-unx.3. Run ./install-tl and follow the instructions.4. TeXLive should now be installed under /usr/local/texlive/YEAR/, where YEAR is the four digit year (e.g. 2016). In this way, it is possible to have multiple TeXLive versions alongside each other and switch between them by changing your PATH variable. Open this folder and check the bin folder. It should contain a subfolder, which (depending on your platform) will be something like i386-linux or x86_64-linux. Add the TeX Live binary folder to your path with5. EXPORT PATH=/usr/local/texlive/YEAR/bin/PLATFORM:$PATH where YEAR is the four digit year (e.g. 2016), and PLATFORM is your platform (e.g. x86_64-linux). Test Installation The LaTeX installation is now complete. To test it, create a new file with your favorite text editor, name it test.tex and add the following content: \documentclass{article} \begin{document} Hello World! \end{document}
📄 Page
7
GoalKicker.com – LaTeX Notes for Professionals 4 Now, open the console or terminal, navigate to the folder where you saved test.tex and run pdflatex test (Note that your editor may have facilities to run this for you.) This creates several new files, including test.pdf. This is the output document, and looks like this:
📄 Page
8
GoalKicker.com – LaTeX Notes for Professionals 5
📄 Page
9
GoalKicker.com – LaTeX Notes for Professionals 6 Congratulations, you have successfully installed LaTeX, and created your first LaTeX document!
📄 Page
10
GoalKicker.com – LaTeX Notes for Professionals 7 Chapter 2: Title Pages Section 2.1: Standard report titlepage \documentclass{report} \begin{document} \title{I want to be a Wombat} \author{Carl Capybara} \maketitle \end{document} This will create a title page with no other content:
📄 Page
11
GoalKicker.com – LaTeX Notes for Professionals 8 Chapter 3: Header and Footer Section 3.1: Using fancyhdr and titleps packages \documentclass[12pt]{article} \usepackage{titleps} \usepackage{fancyhdr} \usepackage{graphicx} \usepackage{lipsum} % for dummy text \pagestyle{myheadings} \pagestyle{fancy} \fancyhf{} \setlength{\headheight}{30pt} \renewcommand{\headrulewidth}{4pt} \renewcommand{\footrulewidth}{2pt} \fancyhead[L]{\includegraphics[width=1cm]{example-image-a}} \fancyhead[C]{} \fancyhead[R]{\rightmark} \fancyfoot[L]{ABC} \fancyfoot[C]{\textcopyright xyz} \fancyfoot[R]{\thepage} \begin{document} \section{First section} \subsection{One} \lipsum[1-3] \subsection{Two} \lipsum[4-6] \end{document}
📄 Page
12
GoalKicker.com – LaTeX Notes for Professionals 9 Section 3.2: Page number as CurrPage/TotalPages in footer \documentclass[12pt]{article} \usepackage{lastpage} \usepackage{fancyhdr} \usepackage{graphicx} \usepackage{lipsum} % for dummy text \pagestyle{myheadings}
📄 Page
13
GoalKicker.com – LaTeX Notes for Professionals 10 \pagestyle{fancy} \fancyhf{} \setlength{\headheight}{30pt} \renewcommand{\headrulewidth}{1pt} \renewcommand{\footrulewidth}{2pt} \lhead{\includegraphics[width=1cm]{example-image-a}} \rhead{} \lfoot{ABC} \rfoot{\thepage/\pageref{LastPage}} \begin{document} \section{First section} \subsection{One} \lipsum[1-3] \end{document}
📄 Page
14
GoalKicker.com – LaTeX Notes for Professionals 11 Chapter 4: Text Formatting Section 4.1: Bold text In order to typeset text in bold, use \textbf: \textbf{This text is typeset in bold.} Section 4.2: Emphazise Text In order to emphasize text the command \emph can be used which usually displays the text in an italics font: This is some text with \emph{emphasized words}. Section 4.3: Strike through text The command \sout of the package ulem strikes through a text: \sout{This text is striked through} The package ulem redefines the command \emph. When you do not want to have this behavior you can use the package ulem with the option normalem: \usepackage[normalem]{ulem}
📄 Page
15
GoalKicker.com – LaTeX Notes for Professionals 12 Chapter 5: Tables Section 5.1: The tabular environment The tabular environment is the most basic way to create a table in LaTeX and doesn't require any other packages. \begin{tabular}{|lcr||} left aligned column & center column & right column \\ \hline text & text & text \\ text & text & text \\ \end{tabular} The parameter (|lcr|| in the example) is called the table specification and tells LaTeX how many columns there are and how they are supposed to be formatted. Each letter represents a single column. Possible values are: Character Meaning l left aligned column c centered column r right aligned column p{'width'} e.g. p{5cm} paragraph column with defined width | (pipe character) vertical line || (2 pipes) 2 vertical lines Cells are separated by the & character. A row is ended by 2 back slashes \\. Horizontal lines can be inserted by using the \hline command. Tables are always formatted to be wide enough to include all the content. If a table is to big, LaTeX will print overfull hbox warnings. Possible solutions include using the p{'width'} specifier or other packages like tabularx. A table with column headings spanning over several columns can be created using the command \multicolumn{cols}{pos}{text}. \begin{center} \begin{tabular}{|c|c|c|c|} \hline &\multicolumn{3}{|c|}{Income Groups}\\ \cline{2-4} City&Lower&Middle&Higher\\ \hline City-1& 11 & 21 & 13\\ City-2& 21 & 31 &41\\ \hline \end{tabular} \end{center}
📄 Page
16
GoalKicker.com – LaTeX Notes for Professionals 13 Note that the command \multicolumn has three mandatory arguments: the first argument specifies the number of columns over which the heading spans; the second argument specifies the position of the heading(l,c,r); and the third argument is the text for heading. The command \cline{2-4} specifies the the starting column(here, 2) and ending column(here, 4) over which a line is to be drawn. Section 5.2: Coloring Table To make the table more readable, following are the ways to color it: Rows1. Columns2. Lines3. Cells4. Coloring Rows Use \rowcolor (provided by colortbl; also loaded by xcolor under the [table] package option). Example: \documentclass{article} \usepackage[table]{xcolor} \begin{document} \begin{tabular}{ | l | l | l | } \rowcolor{green} A & B & C \\ \rowcolor{red} D & E & F \\ G & H & I \\ \rowcolor{blue} J & K & L \end{tabular} \end{document} Coloring Columns Columns can be colored using following ways:
📄 Page
17
GoalKicker.com – LaTeX Notes for Professionals 14 Defining column color property outside the table tag using \newcolumntype: \newcolumntype{a}{ >{\columncolor{yellow}} c } Defining column color property inside the table parameters \begin{tabular}{ | >{\columncolor{red}} c | l | l } Example: \documentclass{article} \usepackage[table]{xcolor} \newcolumntype{a}{>{\columncolor{yellow}}c} \newcolumntype{b}{>{\columncolor{green}}c} \begin{document} \begin{tabular}{ a | >{\columncolor{red}}c | l | b } \hline A & B & C & D \\ E & F & G & H \\ \hline \end{tabular} \end{document} Coloring Lines Use \arrayrulecolor. Example: \documentclass{article} \usepackage[table]{xcolor} \arrayrulecolor{blue} \begin{document} \begin{tabular}{ | l | l | l | } \hline A & B & C \\ \hline D & E & F\\ \hline G & H & I \\ \hline \end{tabular} \end{document}
📄 Page
18
GoalKicker.com – LaTeX Notes for Professionals 15 Coloring Cells Use \cellcolor. Example: \documentclass{article} \usepackage[table]{xcolor} \begin{document} \begin{tabular}{ | l | l | l | } \hline A & B & C \\ \hline D & E & \cellcolor{green}F \\ \hline G & H & I \\ \hline \end{tabular} \end{document} We can define our own colors too using package colortbl. Following are the tags examples: \definecolor{Gray}{gray}{0.85} \columncolor[RGB]{230, 242, 255}} \columncolor[HTML]{AAACED}
📄 Page
19
GoalKicker.com – LaTeX Notes for Professionals 16 Chapter 6: Typesetting Mathematics One of the biggest advantages of LaTeX is its skill in typesetting equations. Here, the fundamentals of typesetting equations, some of the various packages that can be used, as well as common symbols, are described. Section 6.1: Basic Equations Simple, Inline Equations You can do a simple inline equation by using $an equation here$. For example, you might do $\lim\limits_{n \to \infty} \frac{1}{2^n} i\bar z$ which, if we put a little fake text around it, gives Numbered, Centered Equations When writing papers or other documents, it is sometimes preferable to have your equations centered and numbered, as opposed to in-line. Then, use the \begin{equation} and \end{equation} commands. For example, if we use the code \begin{equation} \lim\limits_{n \to \infty} \frac{1}{2^n} i\bar z \end{equation} And add a little text around it, we get You can remove the numbering of the equation by using \begin{equation*} and \end{equation*}. For example, if we use the code \begin{equation*} \lim\limits_{n \to \infty} \frac{1}{2^n} i\bar z \end{equation*} and add a little text around it, we get (though it should be noted you have to use the amsmath package for this).
📄 Page
20
GoalKicker.com – LaTeX Notes for Professionals 17 Section 6.2: Finding Symbols Sometimes, it can be difficult to find the mathematical symbol you need. There are several options here. The first (and quickest) is to use Detexify, where you draw the symbol you'd like, and it tries to find what you want, like as shown below: Another option is to use the comprehensive LaTeX symbols list, which can be found here. If you are using the package unicode-math this list of all supported symbols can be helpful. Another option is this website, which has common math symbols. Section 6.3: Packages available for use While standard LaTeX is all that is needed for most simple mathematical formulae and equations, sometimes more symbols and tools are needed. There are multiple packages available that will enhance your equations and provide you with more to work with. Three of the main packages are described below. Remember, to load a package, type \usepackage{package} in your document preamble. amsmath The amsmath package is an incredibly useful package. It is used to allow your equations to be centered but not numbered, as in \begin{equation*}, it is used to create matrices (as described below) and it introduces many other useful commands, such as \overset and \underset, described below. The amsmath package documentation can be found here. mathtools The mathtools package builds off of the amsmath package, adding further useful symbols and tools. It automatically loads the amsmath package, so you do not need to load both in your document preamble. The mathtools documentation can be found here. amssymb The amssymb package provides many extra symbols that can be very handy for more complex equations. The amssymb documentation can be found here.
The above is a preview of the first 20 pages. Register to read the complete e-book.