Example: biology

Useful LATEX Commands David Woods - Trinity College Dublin

Useful LATEX CommandsDavid ClassesThese will come at the beginning of the document, generally the very first line. Use\begin{document}tostart adding content, and\end{document}to margins for double-sided printingarticleVery versatile and commonly used classslidesLarge sans-serif fontletterLess common, but used for writing lettersa0posterDesigned for poster formatsbeamerCommonly used class for presentationsDocument Class OptionsYou can also specify options to several LATEX Commands , by providing them in square brackets before the curlybraces. You can use multiple options by separating them with commas. For example:\documentclass[a4paper,10pt]{art icle}tells LATEX to format the article for A4-sized paper, and use a10pt font by default. Most of the above document classes will accept combinations of the below options. Youshould also try out other variations on them ( a3paper works as well as a4paper, etc.)

So far, we have mostly only looked at what LaTeX can do in ‘text-mode’, but there are other modes we can use – the main one you’ll be interested in is ‘math-mode’, which will format text and numbers to better appear in a mathematical equation, or similar.

Tags:

  Texts, Latex

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Useful LATEX Commands David Woods - Trinity College Dublin

1 Useful LATEX CommandsDavid ClassesThese will come at the beginning of the document, generally the very first line. Use\begin{document}tostart adding content, and\end{document}to margins for double-sided printingarticleVery versatile and commonly used classslidesLarge sans-serif fontletterLess common, but used for writing lettersa0posterDesigned for poster formatsbeamerCommonly used class for presentationsDocument Class OptionsYou can also specify options to several LATEX Commands , by providing them in square brackets before the curlybraces. You can use multiple options by separating them with commas. For example:\documentclass[a4paper,10pt]{art icle}tells LATEX to format the article for A4-sized paper, and use a10pt font by default. Most of the above document classes will accept combinations of the below options. Youshould also try out other variations on them ( a3paper works as well as a4paper, etc.)

2 Certain documentclasses will set some options by the default font size for the documentletterpaper/a4paperSets the paper sizetwocolumnUses two columnstwosideFormats the margins for double-sided printinglandscapeUse landscape orientationtitlepage/notitlepagePut the title on its own pagePreambleSome Commands must be declared in the preamble, before\begin{document}, in order to take effect. Thisincludes packages and the title packages are built in to LATEX without needing to download anything additional though many hundredmore are available online to extend the capabilities of the system. Packages are declared using this command:\usepackage{package}. Some packages have an immediate effect by including them, others enable you to usenew environments or 1 inch marginsmulticolUsencolumns:\begin{multic ols}{n}graphicxShow image:\includegraphics{file}urlInsert URL:\url{http://.}

3 }verbatimUse verbatim:\begin{verbatim}timesUse Times New Roman font1 TitleThe declaration\maketitlegoes inside the document environment and formats this information. You canchange whether it goes on its own page using the document class option.\author{text}Author of the document\title{text}Title of the document\date{text}Date you can use\todayto generate the current date, or specify whatever text you wantDocument StructureThese Commands help you to structure your document. You can add an asterisk * ( \section*{title}) tosuppress the section numbers these sections will not appear in the table of contents.\tableofcontentsInserts a table of contents at the place the command is in the document\chapter{title}A chapter\section{title}A section\subsection{title}A subsection\subsubsection{title}A subsubsection\paragraph{title}A paragraph not particularly commonText EnvironmentsSpecify these using\begin{environment}and\end{environm ent}quoteIndented quote blockquotationLike quote, with indented paragraphsverseLike quotation, with inverted indentationverbatimMonospace text with literal charactersverbatim*Verbatim, with spaces printed asLists\begin{itemize}Bulleted list\begin{enumerate}Numbered list\begin{description}Description list\itemtextAdd an item\item[x]

4 TextUsexinstead of bullet or number,required for descriptionReferences\label{marker}Set marker for cross-reference\ref{marker}Give section number for marker\pageref{marker}Give page number of marker\footnote{text}Print footnote at bottom of pageFloating BodiesTheplaceoption can specify where on the page the float should go. You can add!to make sure that it will go inthe right place even if LATEX thinks it would be ,h=here,b=bottom,p=separate page. Captions andlabel markers should go inside the environment.\begin{table}[place]Add numbered table\begin{figure}[place]Add numbered figure\begin{equation}[place]Add numbered equation\caption{text}Caption for the float2 Text PropertiesFont FaceThecommandanddeclarationversions of these are mostly the same, though the command handles spacing a littlebetter. If you use a declaration without the wrapping curly braces, the rest of the text in the document will \textrm{text} {\rmfamilytext}Roman family\textsf{text} {\sffamilytext}Sans serif family\texttt{text} {\ttfamilytext} Typewriter family\textmd{text} {\mdseriestext}Medium series\textbf{text} {\bfseriestext}Bold series\textup{text} {\upshapetext}Upright shape\textit{text} {\itshapetext}Italic shape\textsl{text} {\slshapetext}Slanted shape\textsc{text} {\scshapetext}SMALLCAPS SHAPE\emph{text} {\emtext}Emphasized\textnormal{text}{\no rmalfonttext}Document font\underline{text}UnderlineFont SizeThese are declarations, and you should use the curly brace format ({\small.)}

5 }) in order to prevent it fromaffecting the whole document.\tinytext\scriptsizetext\footno tesizetext\smalltext\normalsizetext\larg etext\Largetext\LARGE text\hugetext\HugetextJustificationEnvir onment\begin{center}\begin{flushleft}\be gin{flushright}Declaration\centering\rag gedright\raggedleftText-mode Symbols\&&\$$\%%\\ {} \ {} \ldots..\textbar|\##\textbullet \textbackslash\\S 3 BreaksNote that it is necessary to have a blank line between paragraphs, or else LATEX will treat them as the sameparagraph.\\Begin new line without new paragraph\pagebreakBegin new page\noindentDo not indent current lineMiscellaneous$\sim$Prints (instead of ) Space, prevents line break ( George W. Bush)\hspace{l}Horizontal space of lengthl( )\vspace{l}Vertical space of lengthl\rule{w}{h}Line of widthwand heighthTabular EnvironmentThis environment (\begin{tabular}{cols}) is very Useful for creating good-looking tables.

6 Thecolsargu-ment lets you specify how many columns the table should have, how they should be justified, and how they shouldbe separated. Use a line-break (\\) to separate rows. See the end of this document for an Column SpecificationlLeft-justified columncCentered columnrRight-justified column|Inserts vertical line between columns&Separates cells by column\hlineHorizontal line between rowsAnd is only scratching the surface of LATEX . There is much, much more to the system, but this will hopefully giveyou a good starting point. So far, we have mostly only looked at what LATEX can do in text-mode , but there areother modes we can use the main one you ll be interested in is math-mode , which will format text and numbersto better appear in a mathematical equation, or encourage you to search online for more Commands you can use. If you are stuck on a topic, there are plenty ofsources available to help you out, such as the TeX Stack Exchange1and the LATEX entry on WikiBooks2, and youare always welcome to send me an email if you feel I might be more Useful to I can t say you will definitely benefit from using LATEX to write your documents, you may find it a usefulskill to have, and it will enable you to produce high-quality, professional-looking work that your professors willappreciate if no-one else.

7 There are also packages available designed for use in linguistics ( typing the symbolsof the International Phonetic Alphabet), so it s probably worth knowing for that. And since it you (generally)compile to a PDF, you are guaranteeing that no matter who sees your final document, or what system or viewerthey are using, it will look the same for them as it did when you compiled you have any questions, please let me know either in class or by email, and I will do my best to answer LATEX documentCompile this and see if you can understand the output that you get. Try editing the document to see what changesyou can make.\documentclass[11pt]{article}\usepa ckage{fullpage}\title{Template}\author{N ame}\begin{document}\maketitle\section{s ection}\subsection*{subsection without number}text \textbf{bold text} text. Some math: $2+2=5$\subsection{subsection}text \emph{emphasized text} the structure of table:\begin{table}[!]

8 H]\begin{tabular}{|l|c|r|}\hlinefirst & row & data \\second & row & data \\\hline\end{tabular}\caption{This is the caption}\label{example:table}\end{table} The table is numbered \ref{example:table}.\end{document}Source .


Related search queries