2012-02-29

Away From The Usual Word-Processor

If you ask someone to write an article or a report, chances are a word-processor (OpenOffice, Word, etc.) will be used. Of course they offer the WYSIWYG convenience of instant gratification. But there's a pitfall: formatting. This may not be a problem (especially for power-users) but for some, it's a nightmare to have to spend a lot of time tweaking it! I think this problem is common in academic institutions—people just differ in their preferences.

Mark-up language developers (e.g. HTML) have noticed this and separated the data and the formatting. Thus, CSS was invented (latest version is CSS3) just to take care of the formatting. A web writer just takes care of the content. Well, another typesetting mark-up language is LaTeX—all you need to do is write and the formatting becomes automatic. Admittedly, LaTeX beginners need to read a lot initially, but this pays-off later when all you worry about is the content.

Lifting from its website: “LaTeX ('X' pronounced as 'K') is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents.” The program can output many kinds of files, but what I use is PDF (readily viewed with many Document/PDF viewers, including Adobe® Reader).

There are many LaTeX documentations on-line and several tutorials are available. I made a TEX file (text file with a .tex at the end) below that incorporates a mini-tutorial. One can use this file because the notes are commented out (preceded by a '%' symbol). Download template.tex file...
% template.tex - LaTeX template source file
% Mini-tutorial incorporated as comments
%   uncomment, comment-out or modify as necessary
%   (my LaTeX program accepts all these commands; check your
%    LaTeX syntax & documentation if error messages appear.)
%
\documentclass[14pt, letterpaper, english]{extarticle}
% \documentclass[12pt, letterpaper, english]{article}
%   {article} only allows 10 (default), 11 and 12pt sizes
%   {extarticle} is used for larger fonts sizes
% alt classes: {book, letter, report, thesis ...}
% alt option: [twoside] = for 2-sided document (odd, even numbered page)
%
% Some packages here are default in Texmaker
%   (http://www.xm1math.net/texmaker/)
% In my computer (Ubuntu), installing texmaker automatically installs
% other required packages.  However, some computers need to have perl
% (http://strawberryperl.com/ for Windows) and TeX Live
% (http://www.tug.org/texlive/acquire-netinstall.html) installed.
%
\usepackage[utf8x]{inputenc}    % encoding
\usepackage{times}
\usepackage[letterpaper, top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
%   comment-out to use the default page geometry/layout
%   alt option: [landscape]; [portrait] is default
\usepackage{mathptmx}     % scalable fonts (similar to {times}) in MATH mode
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{babel}              % formatting
\usepackage{graphicx}           % importing EPS graphics
\usepackage{ulem}               % use underline in text
% \usepackage{lscape}           % allow selective {landscape} environment
% \usepackage{multicol}         % uncomment if {multicolumn} command issued
% \usepackage{multirow}         % uncomment if {multirow} command issued
% \usepackage{fancyhdr}         % customize headers/footers
%   \pagestyle{fancy}           % used with {fancyhdr}
% \usepackage{setspace}         % change line spacing
% \usepackage{alltt}            % to use {verbatim} with commands enabled
% \usepackage{moreverb}         % uncomment if {listing} env is used
% \usepackage{wrapfig}          % wrap figures; caution: not a float
% \usepackage{natbib}           % alt bibliography package
%   \bibpunct{[}{]}{;}{s}{,}{,} % ancillary to {natbib}; alt to {s}: {n}, {a}
%
\usepackage[pdftex]{hyperref}   % allow hypertext
  \hypersetup{
    pdfauthor={NAME},
    pdftitle={PDF \LaTeX{}},
    colorlinks,
    pdfpagelayout={OneColumn}}
%     add {backref} if with bibliography backlinks
%
%
% \DeclareMathSizes{ds}{ts}{ss}{sss} % change font sizes in Math mode
%   {ds} must be the same size as the document font
%
\title{TITLE}
\author{NAME \\                   % \\ = newline character
\texttt{EMAIL}}                   % additional AUTHOR data
\date{\today}                     % insert DATE today
%
%
\begin{document}
\normalem                         % \emph{} = italicized, not underlined
%
% \maketitle                      % place TITLE data on document
% \thispagestyle{empty}           % suppress paging for this page only
% \tableofcontents                % insert TOC
%   \setcounter{tocdepth}{depth}  % set depth (default: 3)
% \listoffigures                  % insert list of figures
% \listoftables                   % insert list of tables
%
% DIVISIONS
%
% \division{header}               % syntax
% \division*{header}              %   div numbers omitted
%
% Divisions:
%   section, subsection, subsubsection  % class article, extarticle
%   Others:                             % other classes
%     part, chapter                     %   higher levels
%     paragraph, subparagraph           %   lower levels
%
% To include unnumbered entries in TOC (not included by default):
% \division*{header}                    % syntax; lines bunched together
% \addcontentsline{type}{section_level}{entry} % to reinstate a line in TOC
% \phantomsection                       % used to build links in TOC
%   Example:
%   \section*{Preface}                       % unnumbered section
%   \addcontentsline{toc}{section}{Preface}  % place at appropriate location
%     of section/figure/table in document in order for it
%     to be extracted in the correct order in the TOC.
%   \phantomsection
%
% ENVIRONMENTS
%
% \begin{ENVIRONMENT}                         % syntax
%   ...                                       % content
% \end{ENVIRONMENT}
%
% Environments:
%   abstract                                  % insert Document Abstract
%   flushleft, flushright, center             % Justification
%   singlespace, onehalfspace, doublespace    % Line spacing
%   landscape                                 % Page Orientation
%   quote (short quotes), quotation (longer quotes/more indent)
%   verse (poetry)                            % \\ to break a line
%   verbatim, alltt (verbatim + enabled commands)
%   listing (+ line numbers in verbatim; eg: \begin{listing}[step]{1st line})
%
% LIST STRUCTURES
%
% List environments      % can be nested up to depth = 4
% \begin{itemize}        % bulleted; \begin{enumerate} for ordered list
%   \item item 1
%   \item item 2
% \end{itemize}          % or \end{enumerate}
% \begin{description}    % similar to glossary
%   \item[entry] item 1
%   \item[entry] item 2
% \end{description}
%
% TABLE
%
% Table environments/commands:
%   \multicolumn{spanned columns}{format}{cell contents}  % syntax;
%              % used in merging columns
%              % if associated with {figure}, use {figure*} to span columns.
%   \multirow{spanned rows}{*}{cell contents}             % syntax
%              % used in merging rows
%   \setlength{\columnseprule}{1pt}  % place before environment
%              % to have a line width of 1pt, e.g. (default = 0pt)
%   \setlength{\columnsep}{20pt}     % place before environment
%              % to change default separation of 10pt to 20pt, e.g.
% Example:
% \begin{table}[htp]  % table = float; [htp] = where LaTeX will place table:
%                     % h = here, t = page top, b = page bottom
%   \begin{center}    % center justified
%     \caption{table-title}                    % Title of table
%     \label{table-label}                      % anchor/label
%     \begin{tabular}{| l | c | p{5cm} |}      % lcr = cell justification;
%          % | = vertical line visible; p{5cm} = width is 5 cm in this column
%       \hline                  % horizontal line visible; & = cell-separator
%       contents & contents & more content \\  % \\ = newline
%       \hline
%       \multirow{2}{*}{contents} & \multicolumn{2}{|c|}{more content} \\
%          % \hline omitted to avoid overlap due to the multicolumns/rows
%       & content & This is a wrapping sentence. \\
%       \hline
%     \end{tabular}                            % 3x3 table
%   \end{center}
% \end{table}
%
% FIGURE/GRAPHICS
%
% Example:
% \begin{figure}[htp]  % figure = float; h = here, t = top, b = bottom of page
%   \begin{center}                  % center justified
%     \includegraphics{image}       % image: EPS for latex command
%                                   % JPG, PNG, PDF for pdflatex command
%   \end{center}
%   \caption{caption text}          % optional caption
%   \label{image-label}             % optional anchor/label
%                      % use of label: text can reference it like so...
%                      % ... See figure~\ref{image-label} for reference...
%                      % alt: \pageref{}  % reference page (not figure)
% \end{figure}
%
% Wrap text around a figure:        % caution: not considered as float
% \begin{wrapfigure}{r}{40mm}       % {wrapfigure} replaces {figure}
%   ...                             % can run over a page break
% \end{wrapfigure}                  % check final document because of above
%
% FORMAT
%
% \emph{emphasis/italic}  \textbf{bold}           \texttt{teletype}
% \textsc{small caps}     \textsf{sans serif}     \textrm{serif}
% \uline{underline}       \uwave{wavy underline}  \sout{strike-out}
%
% - (hyphen)              -- (en-dash)             --- (em-dash)
% `single quotes'         ``double quotes'' or "  \\ (newline)
% \& (&)                  \% (%)                  \$ ($)
% \# (#)                  \{ \} ({})              \_ (_)
% ~ (nbsp)                \ldots (ellipsis)       \textbar (|)
% \textbackslash (\)      \textless (<)           \textgreater (>)
% \textregistered         \copyright              \pounds
% \LaTeX{}                \dag (dagger)           \`{a}
% \"{o}                   \^{o}                   \r{A}
% \'{e}                   \~{n}                   \.{o}
% \c{c}
%
% White space:
% \quad = font size       \qquad = double quad    % horizontal space
% \, = small space (1/6 quad)
% \: = medium space (2/9 quad)
% \; = large space (5/18 quad)
% \! = negative space (-1/6)
% \vspace{width}                         % vertical space
% Example:
% \vspace{\baselineskip}                 % vertical space between paragraphs
%
% Size:                                  % should be used rarely
% \tiny                   \scriptsize             \footnotesize
% \small                  \normalsize             \large
% \Large                  \LARGE                  \huge
% \Huge
%   % in case where size format continues, insert \normalsize
%   % so that succeeding text is back to default
%
% Other formatting commands:
% \newline              % or \\; breaks line
% \linebreak[number]    % breaks line + stretch line to the margin;
%                       % [number]: 0-4, with 4 as most insistent
%                       % seems LaTeX has final say
% \newpage              % ends current page
% \pagebreak[number]    % breaks current page
% \nopagebreak[number]  % stops automatic page break
% \clearpage            % ends page + pending floats will be printed
%
% NOTES
%
% \footnote{footnote text}   % insert footnote
% \thanks{title-footnote}    % insert footnote within \title
% \marginpar{marginal text}  % few characters (may overflow)
% \cite{name01}              % insert to mark bibliography reference, e.g.
%                            % alt: \citep, \citet, \citep*, \citet*
%
% CUSTOMIZE
%
% Headers/Footers:
%
% \fancyhead{}            \fancyfoot{}            % insert at the beginning
% \lhead[even page]{odd page} \lfoot[even page]{odd page}
% \chead[even page]{odd page} \cfoot[even page]{odd page}
% \rhead[even page]{odd page} \rfoot[even page]{odd page}
%                                   % put header/footer data within [] and {}
% Input data examples:
% \today = date today           \thepage = page number
% Example:
% \cfoot[\thepage]{\thepage}        % put page number in all pages (default)
%
% Redefining Counter styles:
%
% \renewcommand{\thefootnote}{\alph{footnote}}
%                              % redefine default \footnote to use lower case
% \renewcommand{\theenumi}{\Roman{enumi}}    % redefine enumerate 1st level
% \renewcommand{\labelenumi}{\theenumi}
% \renewcommand{\theenumii}{\Alph{enumii}}   % redefine the 2nd level
% \renewcommand{\labelenumii}{\theenumii}
% \renewcommand{\labelitemi}{symbol to use}  % redefine itemized labels
%                                        % alt: arabic, alph, roman, fnsymbol
%
% HYPERTEXT
%
% Hyperref:
% \href{URL}{linked text}                % similar to HREF in HTML
% \url{URL}                              % url is shown/linked
% \nolinkurl{URL}                        % url is shown and NOT linked
% \hyperbaseurl{URL}                     % set base url
% \hyperlink{id}{link to target text}    % link within document
% \hyperref[label]{linked text}          % similar to \hyperlink, \ref{label}
% \hyperimage{image-URL}{linked text}    % link to image-url
% \hypertarget{id}{anchor/target text}   % target text
%
% MATHEMATICS
%
% \begin{math}...\end{math}                 \(...\)   $...$    % text type
% \begin{displaymath}...\end{displaymath}   \[...\]   $$...$$  % displayed type
% \begin{equation}...\end{equation}      % alt to {displaymath}
%                                        % equation numbers printed
%
% Commands:
% \times                  \div                    \frac{}{}
% ^{} = power             _{} = index             \sqrt[]{}
% \left(...\right)              % scalable parentheses; (...) = non-scalable
% \mbox{}                       % put text in equations
%
% alt to \mbox{} (can be wrapped around equation):
% \mathrm{}               \mathit{}               \mathbf{}
% \mathsf{}               \mathtt{}               \mathcal{}  % (calligraphy)
%
% Predefined math text sizes:               % sizes decrease
% \displaystyle           \textstyle              \scriptstyle
% \scriptscriptstyle
% Example:
%   \frac{1}{\scriptstyle a_1...}           % denominator is smaller
%
% Matrix:
% $$ \left[                                 % scalable [
%   \begin{array}{ c c }                    % 2x2 matrix
%      1 & 2 \\                             % similar to {tabular} environment
%      3 & 4
%   \end{array} \right]                     % scalable ]
% $$
%
% Equation arrays:         % use for multi-line equations + equation numbers
% \begin{eqnarray}         % use {eqnarray*} to disable equation numbers
%   left expression & = & right expression 1 \\
%   & = & right expression 2 \nonumber \\   % \nonumber = no equation number
%   & = & right expression 3
% \end{eqnarray}
%
% BIBLIOGRAPHY
%
% \bibliographystyle{plain}                 % default linked bibliography
%   \bibliographystyle{plainnat}            % uncomment if {natbib} is used
%   latex makebst: command to make own bibliography style
% \bibliography{/PATH/to/the/bibliography/folder}
%
% Example of linked bibliography:  % placed in a BIB file in bibliography PATH
% @book{name01,                             % used in \cite{}
%   author    = "Surname, First Name",      % author
%   title     = "{T}itle",     % title; {T} = capitalized character (optional)
%   edition   = "Edition",                  % edition
%   year      = "2012",                     % year published
%   publisher = "Publisher Data",           % publisher
%   address   = "Address of Publisher"      % publisher address
% }                   % add other entries as necessary using the same pattern
%                     % entries should be separated by blank lines
%
% Example of embedded bibliography:
% \begin{thebibliography}{9}                % embedded in TEX file
%                                           % 9 = maximum number; alt: 99, 999
%   \bibitem{name01}                        % used in \cite{}
%   NAME,                                   % author
%   \emph{TITLE}.                           % title
%   Publisher Data,                         % publisher
%   Nth Edition,                            % edition
%   2012.                                   % year published
% \end{thebibliography}
%
% NOTES
%
% Save TEX files in own folders/directories, with referenced files.
% Running pdflatex in console:
%   $ cd /directory/where/TEX/file/resides
%   $ pdflatex file           # file.tex (.tex is dropped)
%           # that's enough for simple files
%           # large files with many references may require at least 2 passes
%           # check the text output if more passes are required
%           # files with bibliographies may require an additional command:
%   $ bibtex file             # usually issued second
%                             # bibliography file (file.bib) must be present
%                             # at '/PATH/to/the/bibliography/folder'
%   $ pdflatex file           # repeat command as necessary (maybe up to 2x)
%   A file.pdf will be generated in the directory
%
% If you prefer running latex in console:
% replace 'pdflatex' with 'latex', but a file.dvi is generated.
% To make a PDF file, issue the command:
%   $ dvipdf file.dvi file.pdf
%   A file.pdf will be generated in the directory
%
% For LaTeX developers: why not issue only ONE command,
%   and let the program do all these other repeated commands?
%
% Check: http://www.latex-project.org/, Google, etc. for more information.
%
% Start typing and let LaTeX do the formatting!
%%============================================================================%%

\LaTeX{} DOCUMENT

\end{document}
LaTeX is a good addition to the writer's arsenal. Let the writer write!

No comments: