410 likes | 518 Views
BIL101, Introduction to Computers and Information Systems. Chapter 8
E N D
BIL101, Introduction to Computers and Information Systems Chapter 8 • TeX: The Stradivarius Language of Word Processingand Document PreparationPartially Based on the some chapters of the books entitledA Gentle Introduction to TEX, A Manual for Self-study by Michael DoobandTeX book byDonald E. KnuthWritten byMetin DemiralpIstanbul Technical University, Informatics Institute, Maslak - 80626, İstanbul, TÜRKİYEVersion 0.60
TEX: Stradivarius Language of Word Processing and Document Preparation • TEX is a programming language like HTML. Hence, this is the second time to encounter the programming technologies. This will be very helpfull when we deal with SQL, GnuPlot and Mahtematica ...
The Name, a Short History, and Identification • The words like technology find their roots in the Greek originated term starting with the letters τ which means art as well as technology. We imply that this facility, that is, TEX is a master tool which is equipped with both technology and art.
TEX was developed by Donald E. Knuth who was a Computer Science guru at Stanford University, through a major project of the same University in 1970’s. The purpose was to create a software package which removes or diminishes all difficulties in the document preparation into a very minor level. After TEX was born there had been a lot of efforts to create new macro packages to facilitate its utilization.
The reason why we pronounce TEX like tech or more precisely tecks is to remind the user TEX is essentially concerned with high-quality technical manuscripts. It emphasizes on the art and technology and reminds that it the only thing you can use if you want to produce a high fidelity document. If you merely, want to obtain a document which is passably good enough, a simpler system which is called just word processor (like Word) is sufficient.
The main goal of TEX is not just to obtain a readable document but to produce finest quality. • The TEX’s main site in the Internet locates at the URL (Unified Resource Location) http://www.ctan.org. You can find its versions for all major operating systems there. The site has an amazing abundance of programs and utilities about TEX and related things.
The Structure and Running of TEX TEX is in fact a programming language since in contains most of the necessary features to be so. You can use variables, constants, input and output variables, logical statements, loops, an arithmetical operation capability which suffices for the necessary calculation in printing, and macros. It has a modular structure so you can extend or build a new structure which is oriented to a more specific task, on it.
These capabilities give of course a lot of superiorities to TEX over the other softwares and many computer wizards think that it is at a ultimate point where there is no more road to go. This point of TEX is emphasized by giving TEX a version number which is composed of the first few decimal digits of the transcendental number . • TEX works like an interpreter.
When it is invoked it waits line by line input to process and creates an output file whose type is called DVI which is an acronym for the statement DeVice Independent. • TEX needs a bundle of lines as input to produce the desired output. These lines can be composed of commands and text material to be appearing in the output.Each TEX command must start by a backslash character \ and can be composed of lower or upper case letters.
It is possible to define new commands by combining the TEX primitive commands. The entirity of the lines which forms the input a document preparation session is defined as a TEX input file. All TEX files are assumed to have a four letter suffix .tex. The files can be created by means of any editor or editing facility existing in your system.
The creation of the DVI file form a TEX input file can be realized in two ways, either interactive or batch mode. In the interactive mode each line of the input is given separetely but cosecutively. To invoke an interactive mode under SuSE Linux you can give the command texat the commandline interpreter prompt by facing with the following display. demiralp@jaguar:~/bil101 > tex This is TeX, Version 3.14159 (Web2C 7.3.1)
** ** is the global TEX prompt and, to proceed, you must give either a TEX command or a filename for the TEX input file to be pocessed. If you give the correct filename for the TEX input file, say sample.tex then the filename of the file between the parentheses is returned in the next line and a single star prompt appears in the following line like the following display.
demiralp@jaguar:~/bil101 > tex This is TeX, Version 3.14159 (Web2C 7.3.1) **sample.tex (sample.tex)* This happens when the file sample.tex does not contain any terminating command. So what we are going to do for the finalization of the session is to give either end or maybe more securely bye command at this prompt.
If the file sample.tex would contain one of the commands end or bye then the above display would replace with the following one. demiralp@jaguar:~/bil101 > tex This is TeX, Version 3.14159 (Web2C 7.3.1) **sample.tex (sample.tex [1] ) Output written on sample.dvi (1page,220bytes). Transcript written on sample.log.
In the case of termination via end or bye commands an output file created under the name texput.dvi and the text format display of the session is collected into a file whose name is a texput.log. However, in the case where the session is terminated by entering Ctrl d no dvi file is created although all the next format display of the session is saved into the file texput.log.
The batch mode is quite straight forward. We write all necessary TEX commands and the text material to create what we want in the output display into a file whose name contains a four letter suffix.tex. This file is the TEX input file. We run TEX by specifying the name of the input file after tex command followed by at least one space character at the commandline interpreter of the system.
For example, in our SuSE system we can give the display of an attempt to run a TEX file sample.tex and its result as follows. demiralp@jaguar:~/bil101 > tex sample This is TeX, Version 3.14159 (Web2C 7.3.1) (sample.tex [1] ) Output written sample.dvi (1 page,216 bytes). Transcript written on sample.log. The interactivemode is more pedagogical because of the instant reaction of TEX after entering each line.
The batch mode can also be in the same way but this time the errors can be seen and removed after the run of the commands in the given input file a single entity. • A successful running stage always creates a DVI and LOG files unless a special structure is given to the input file not to produce any output page. DVI and LOG files are created under the names same as the .tex suffixed input filename and suffixes.dvi and .log.
Displaying the DVI Files After the successful editing and running stages the next step is the displying of the output included in the DVI file in binary form. For this task we need a GUI (Graphical User Interface) specific software which is called Driver. Most common driver for X window system is called xdvi.
There are some recently developed environments like KDE or Gnome where some other drivers are under development. For example, SuSE Linux KDE contains a driver for DVI files under the name kdvi. • The Microsoft Windows series or NT use some other type of drivers like dvi2scr although there are some efforts to develop the version xdvi for these systems.
Document Preparation With TEX • Plain Text, Text Alignment and Blocks, Glues, Fonts • Plain TextNow we can start to learn how a TEX input file can be prepared in the editing step by opening a file whose name is sample1.tex. You can use any editor for this purpose and it is quite natural to use your favorite editor.
Text Alignment and BlocksTEX reads all lines of the input file and makes a single strip by changing each character with its roman counterpart and deleting all newline characters without caring how long the final strip is. TEX can use many different fonts and the default font type is called Roman. The dafault size of the font is ten points where 72.22 points are equivalent to one inch.
Each character has a display in a rectangular frame which has three dimensions: width, height and depth. The frame is divided into two vertical segments separated by a horizontal line which is called baseline. The distance between the top edge and the baseline is height. The distance from the baseline to the bottom edge is called depth. The dept of a character may be zero depending on its shape. The width is the length of the baseline.
TEX assumes that the display will be locate on a standard sheet of paper which is either letter or A4 which is a standard mostly used in Europe. The default size of the display can be changed by using the TEX commands \hsize, \vsize, \hoffset, \voffset. • A single line can be left or right justified or centered in the output display. This can be accomplished by using the TEX commands \leftline, \rightline, and \centerline.
All these commands need a single argument which may involve any space or tab characters. The text material to be left or right justified or centered must be given in blocks structure. A block in TEX is a group of commands and text material which are encompassed by the left and right braces {,}. • One more facility about the alignment is the deliberately breaking of the lines within a predefined tolerance.
We can mention two TEX commands to this end: \break, and \goodbreak. \break breaks the line at the point it is given and increases the intermediate spaces such that the new formed line is terminated by the last word before the command. \goodbreak breaks the line at the point it is issued such that some reasonable amount and size of spaces are used and then the remaining portion of the line is filled by the sufficient spaces.
Glues You can create spaces between the words or lines. The spaces can be divided into two categories: skips and glues. skip is a vertical or horizontal space such that it can be divided into pieces if it exceeds the borders of line or page. glue is an indivisible space. skip needs a reference material to be activated. glue does not behave so.
To create a vertical space /vskip or /vglue commands are used. These commands must be followed some lengths like pt (point- 72.22 point = 1 inch), mm, cm. • There are some special purpose skips or glues like \baselineskip, or \parskip, \topskip. In TEX each line has a baseline where the bases of the characters are located. Each character of TEX has three dimensions: width, height and depth.
When two separate characters are joined by matching their rectangles horizontally such that these hypothetical horizontal lines match on the same horizontal direction. This line is called baseline. • The command \parskip is used to make spaces between the paragraphs. If you leave a blank line or use the command \par in the TEX file then TEX inserts a default space between two consecutive lines.
The command \topskip is used to make spaces between the headline and the first line of the page. If not given then TEX uses the default value. The command must be followed by the desired skip value. • Fonts As all typographical utilities do TEX uses fonts. Font is a collection of characters. For TEX the numbers of the characters in a font is limited by 256.
There are two major ways for calling a font inside a TEX document. One and easiest way is to give a calling-by-acronym-command. For example, rm, is used to call roman font of the current size in the document. \it, \sl, \bf, \tt commands are used to call italic, slanted, extended boldface, typewriter fonts respectively. Therefore, one of these commands can be given at any place of the document source file.
The other way for font calling is to use the command \font. This command must be followed by a name which is at our disposal for the font, an equal sign, and the real name of the font in the TEX package. • Mathematical and Display Modes, Formulae Typesetting • Mathematical Mode You can write mathematical formulae by using TEX.
There are two available modes for this purpose. The Mathematical Mode can be created by encompassing the TEX commands and related material by $ signs. Anything given between these signs are considered mathematical objects to be inserted into lines by TEX. So this mode enables us to combine text material and mathematical formulae at the same line.
Display Mode The Display Mode can be created by encompassing the TEX commands and related material by $$ signs. Anything given between these signs are considered mathematical objects to be inserted between lines by TEX. So this mode enables us to typeset mathematical formulae separately.
Formulae Typesetting This task can be done by combining the convenient TEX commands by obeying some rules.
Does \AE schylus understand \OE dipus? Does Æ schylus understand dipus? • The smallest internal unit of \TeX{} is about 53.63\AA.
$(\forall x\in \Re)(\exists y\in\Re)$ $y>x$. ${a+b\over c}\quad {a\over b+c}\quad {1\over a+b+c} \not= {1\over a}+ {1\over b}+{1\over c}$.
What are the points where ${\partial \over \partial x} f(x,y) = {\partial \over \partial y} f(x,y) = 0$? $e^x \quad e^{-x} \quad e^{i\pi}+1=0 \quad x_0 \quad x_0^2 \quad {x_0}^2 \quad 2^{x^x}$.
$\nabla^2 f(x,y) = {\partial^2 f \over\partial x^2}+ {\partial^2 f \over \partial y^2}$.
$$\int \csc^2x\, dx = -\cot x+ C \qquad \lim_{\alpha\to 0} {\sin\alpha \over \alpha} = 1 \qquad \lim_{\alpha\to \infty} {\sin\alpha \over \alpha} = 0.$$ • $$ I_4 = \pmatrix{ 1 &0 &0 &0 \cr0 &1 &0 &0 \cr0 &0 &1 &0 \cr0 &0 &0 &1 \cr}$$
\def\boxtext#1{%\vbox{%\hrule\hbox{\strut \vrule{} #1 \vrule}%\hrule}%}\moveright 2 in \vbox{\offinterlineskip\hbox{\boxtext{6}\boxtext{1}\boxtext {8}}\hbox{\boxtext{7}\boxtext{5}\boxtext{3}}\hbox{\boxtext{2}\boxtext{9}\boxtext{4}}}