Part - I : Short Course Typing Text
Part - I : Short CourseTyping Text
Sanjay Mishra
Department of MathematicsLovely Professional University
Punjab, India
June 14, 2012
Part - I : Short Course Typing Text
Outline
1 Typing TextIntroductionThe KeyboardYour First NoteLines too WideMore Text Features
Part - I : Short Course Typing Text
Typing Text
Introduction
Introduction
First, introduce you to typesetting text by working throughexamples. More details are provided throughout the lecture.A source file is made up of text, math (formulas), andinstructions (commands) to LATEX. For instance, consider thefollowing two examples:
Part - I : Short Course Typing Text
Typing Text
Introduction
Example I
Input in Source File
A source file is made up of text,math (e.g.,$\sqrt{5}$),and \emph{instructions to} \LaTeX.
Output in PDF File
A source file is made up of text,math (e.g.,√
5),andinstructions to LATEX.
RemarksText Part : A source file is made up of text, math (e.g.,Math Part : $\sqrt{5}$Text Part : ),andInstructions → Command with an Argument :\emph{instructions to}Instructions → Command without an Argument :\LaTeX
Part - I : Short Course Typing Text
Typing Text
Introduction
Example I
Input in Source File
A source file is made up of text,math (e.g.,$\sqrt{5}$),and \emph{instructions to} \LaTeX.
Output in PDF File
A source file is made up of text,math (e.g.,√
5),andinstructions to LATEX.
RemarksText Part : A source file is made up of text, math (e.g.,Math Part : $\sqrt{5}$Text Part : ),andInstructions → Command with an Argument :\emph{instructions to}Instructions → Command without an Argument :\LaTeX
Part - I : Short Course Typing Text
Typing Text
Introduction
Example I
Input in Source File
A source file is made up of text,math (e.g.,$\sqrt{5}$),and \emph{instructions to} \LaTeX.
Output in PDF File
A source file is made up of text,math (e.g.,√
5),andinstructions to LATEX.
RemarksText Part : A source file is made up of text, math (e.g.,Math Part : $\sqrt{5}$Text Part : ),andInstructions → Command with an Argument :\emph{instructions to}Instructions → Command without an Argument :\LaTeX
Part - I : Short Course Typing Text
Typing Text
Introduction
Example II
Input in Source File
My first integral: $\int \zeta^{2}(x) \, dx$.
Output in PDF File
My first integral:∫ζ2(x)dx.
Part - I : Short Course Typing Text
Typing Text
Introduction
Example II
Input in Source File
My first integral: $\int \zeta^{2}(x) \, dx$.
Output in PDF File
My first integral:∫ζ2(x)dx.
Part - I : Short Course Typing Text
Typing Text
Introduction
Commands I
Commands, as a rule, start with a backslash ( \ ) and tellLATEX to do something special. In this case, the command\emph emphasizes its argument (the text between thebraces). Another kind of instruction to LATEX is called anenvironment. For instance, the commands
\begin{flushright}
and
\end{flushright}
Part - I : Short Course Typing Text
Typing Text
Introduction
Commands II
enclose a flushright environment; the content, that is, thetext that is typed between these two commands, is rightjustified (lined up against the right margin) when typeset.(The flushleft environment creates left justified text; thecenter environment creates text that is centered horizontallyon the page.)
Part - I : Short Course Typing Text
Typing Text
The Keyboard
The Keyboard
Creating a document in LATEX requires that we type the textand math in the source file. So we start with the keyboard,proceed to type a short note, and learn some simple rules fortyping text in LATEX.
Part - I : Short Course Typing Text
Typing Text
The Keyboard
Important Keys in Keyboard
Basic Keys :
a-z A-Z 0-9 + = * / ( ) [ ]
Punctuation Keys:
, ; . ? ! : ‘ ’ -
Special Keys:
# $ % & ~ _ ^ \ { } @ " |
And the space bar, the Tab key, and the Return (or Enter)key.
Part - I : Short Course Typing Text
Typing Text
Your First Note
Your First Note
We start our discussion on how to type a note in LATEX with asimple example. Suppose you want to use LATEX to producethe following:
Input in Source File
\documentclass{sample}\begin{document}It is of some concern to me that the terminologyused in multi-section math courses is not uniform.In several sections of the course on matrix theory,the strange term ‘‘hamiltonian-reduced’’ is used.
Of special concern to me is the terminology in thecourse by Prof.~Rudi Hochschwabauer. Since his fieldis new, there is no accepted terminology.\end{document}
Part - I : Short Course Typing Text
Typing Text
Your First Note
Output in PDF File
It is of some concern to me that the terminology used inmulti-section math courses is not uniform. In several sections ofthe course on matrix theory, the strange term“hamiltonian-reduced” is used.Of special concern to me is the terminology in the course byProf. Rudi Hochschwabauer. Since his field is new, there is noaccepted terminology.
Part - I : Short Course Typing Text
Typing Text
Your First Note
The text of the note is typed within the documentenvironment, that is, between the lines
\begin{document}
and
\end{document}
Remarks
1 LATEX notices when you put a blank space in the text, butit ignores how many blank spaces have been inserted.
2 LATEX does not distinguish between a blank space(hitting the space bar), a tab (hitting the Tab key), and asingle carriage return (hitting Return once).
3 However, hitting Return twice gives a blank line; one ormore blank lines mark the end of a paragraph.
Part - I : Short Course Typing Text
Typing Text
Your First Note
The text of the note is typed within the documentenvironment, that is, between the lines
\begin{document}
and
\end{document}
Remarks
1 LATEX notices when you put a blank space in the text, butit ignores how many blank spaces have been inserted.
2 LATEX does not distinguish between a blank space(hitting the space bar), a tab (hitting the Tab key), and asingle carriage return (hitting Return once).
3 However, hitting Return twice gives a blank line; one ormore blank lines mark the end of a paragraph.
Part - I : Short Course Typing Text
Typing Text
Your First Note
The text of the note is typed within the documentenvironment, that is, between the lines
\begin{document}
and
\end{document}
Remarks
1 LATEX notices when you put a blank space in the text, butit ignores how many blank spaces have been inserted.
2 LATEX does not distinguish between a blank space(hitting the space bar), a tab (hitting the Tab key), and asingle carriage return (hitting Return once).
3 However, hitting Return twice gives a blank line; one ormore blank lines mark the end of a paragraph.
Part - I : Short Course Typing Text
Typing Text
Lines too Wide
Lines too Wide
LATEX reads the text in the source file one line at a time andwhen the end of a paragraph is reached, LATEX typesets theentire paragraph. Occasionally, LATEX gets into trouble whentrying to split the paragraph into typeset lines.
Part - I : Short Course Typing Text
Typing Text
More Text Features
More Text Features
Now we want to discuss more text features with followingexample
Input in Source File
1 % Sample file: note2.tex2 \documentclass{sample}34 \begin{document}5 \begin{flushright}6 \today7 \end{flushright}8 \textbf{From the desk of George Gr\"{a}tzer}\\[22pt]9 October~7--21 \emph{please} use my10 temporary e-mail address:11 \begin{center}12 \texttt{George\[email protected]}13 \end{center}14 \end{document}
Part - I : Short Course Typing Text
Typing Text
More Text Features
Output in PDF File
June 14, 2012
From the desk of George Grätzer
October 7–21 please use my temporary e-mail address:
Part - I : Short Course Typing Text
Typing Text
More Text Features
Remarks I
1 The \today command (in line 6) to display the date onwhich the document is typeset(so you will see a datedifferent from the date shown above in your own typesetdocument). More Text Features
2 The environments to right justify (lines 3-5) and center(lines 8-11)text.
3 The commands to change the text style:
\emph command (line 8) to emphasize text.\textbf command (line 9) for bold text.\texttt command (line 12) to producetypewriter style text.
These are commands with arguments. In each case, the argument of the command follows the name ofthe command and is typed between braces, that is, between { and }.
Part - I : Short Course Typing Text
Typing Text
More Text Features
Remarks II
4 The form of the LATEX commands:
Almost all LATEX commands start with a backslash ( \ )followed by the command name. For instance, \textbf isa command and textbf is the command name.The command name is terminated by the firstnon-alphabetic character, that is, by any character otherthan a - z or A - Z.Note: The textbf1 is not a command name, in fact,\textbf1 typesets as 1. (Let us look at this a bit moreclosely. \textbf is a valid command. If a command needsan argument and is not followed by braces, then it takesthe next character as its argument. So \textbf1 is thecommand \textbf with the argument 1, which typesetsas bold 1: 1.)
Part - I : Short Course Typing Text
Typing Text
More Text Features
Remarks III
Command names are case sensitive. Typing \Textbf or\TEXTBF generates an error message.
5 The multiple role of hyphens: Double hyphens are used fornumber ranges. For example, 7--21 (in line 9) typesets as7-21. The punctuation mark - is called an endash. Use triplehyphens for the em dash punctuation mark—such as the onein this sentence. More Text Features
6 The new line command, \\ (or \newline): To create additionalspace between lines (as in the last note, under the line Fromthe desk . . . ), you can use the \\ command and specify anappropriate amount of vertical space: \\[22pt]. Note thatthis command uses square brackets rather than bracesbecause the argument is optional. The distance may be givenin points (pt), centimeters (cm), or inches (in).
Part - I : Short Course Typing Text
Typing Text
More Text Features
Remarks IV
7 Special rules for special characters, for accented charactersand for some European characters. For instance, the accentedcharacter ä is typed as \"{a}.
Recall that we also have the SymbolTables.pdf in thesamples folder.