% latex generated by the script '/home/project-web/bumble/cgi-bin/text2latex.cgi'
% with help from the sed script 'text2latex.sed'
% query string: 'books/latex/latex-book'
% sFileName= 'latex-book'
% sDirName = 'books/latex'
% sName = '' -->
% latex by http://bumble.sourceforge.net/scripts/text2latex.sed
% this script is a work in progress
\documentclass[11pt]{article}
\usepackage[hmargin=2cm, vmargin=2cm]{geometry}
\usepackage{url}
\usepackage{hyperref}
\begin{document}
\\&\\& The Latex Document System
----------------------------:
This book is about the LaTeX document and typesetting system. Latex
is a system for typesetting text documents. This system is mostly
used in the academic and scientific world for creating printed
theses, journals and other technical documents, but it is probably
capable of formatting other types of documents, such as newspapers,
personal diaries and general purpose books.
Latex can be seen as the successor to the groff system. While Latex
is a flexible and powerful system it is rather like a maze or an
entangled forest of distributions, options, packages, fonts etc.
Making a path through this forest can be difficult, time consuming
and occasionally frustrating. However the end-result or reward are
very professional looking documents.
@@ \url{http://www.stdout.org/\\$\\verb|~|winston/latex/}
a nice cheat-sheet in pdf and latex
@@ \url{http://www.ctan.org/}
the official site
@@ \url{http://www.tex.ac.uk/cgi-bin/texfaq2html}
the Ctan frequently asked questions lists. This is a very
comprehensive document, which should contain the answers to most
questions, if you have enough time to wade through it.
@@ \url{http://www.tex.ac.uk/tex-archive/help/uk-tex-faq/}
the tex faq in downloadable and printable formats, such as pdf
@@ \url{http://www.kronto.org/thesis/tips/}
a reasonably good set of tips
@@ \url{http://noodle.med.yale.edu/latex/latex2e-html/ltx-2.html}
a good site for LaTeX2e
@@ \url{http://www.latex-community.org/forum}
A forum of questions and answers about latex matters.
@@ \url{http://www.stat.ubc.ca/\\$\\verb|~|webmaste/howto/editor/latex.html\\#wrap}
a bit of a latex howto
\url{http://heather.cs.ucdavis.edu/\\$\\verb|~|matloff/LaTeX/LookHereFirst.html}
ONLINE TUTORIALS AND INTRODUCTIONS
@@ \url{http://www.cs.cornell.edu/Info/Misc/LaTeX-Tutorial/}
@@ \url{http://www.andy-roberts.net/misc/latex/}
a thorough tutorial by a "non-expert"
@@ \url{http://www.maths.tcd.ie/\\$\\verb|~|dwilkins/LaTeXPrimer/}
a simple introduction
* Debian packages for latex
deb: texlive-latex-base-doc
deb: texlive-latex-extra-doc
deb: texlive-latex-recommended-doc
GETTING HELP
* view the manual for latex
>> info latex
* show package descriptions from the debian package "texlive-latex-extra"
>> apt-cache show texlive-latex-extra | grep "\\$\\backslash\\$-\\$\\backslash\\$-" | less
\\#\\#(this package contains a list of useful latex packages)
Documentation for a latex package can be generated directly from the
package "dtx" file.
* generate pdf documentation for a latex "dtx" package
>> pdflatex package.dtx
* find documentation for latex packages in pdf format
>> find \texttt{/usr/share/doc/} -name '*.pdf' \\#\\#(on a debian system, at least)
* read the tex newsgroups and ask questions if you want
>> comp.text.tex \\#\\#(the principal newsgroup)
A SIMPLE DOCUMENT
* possibly the simplest latex document
--------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
Hello \\$\\backslash\\$LaTeX\{\}
\\$\\backslash\\$end\{document\}
,,,
* Another simple latex document
-------------------------------
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\% use packages for extra functionality
\\% \\$\\backslash\\$usepackage[...]\{...\}
\\% start lines with '\\%' to write comments in the latex file
\\$\\backslash\\$title\{Testing\} \\$\\backslash\\$author\{Donald K\} \\$\\backslash\\$date\{\\$\\backslash\\$today\}
\\$\\backslash\\$begin\{document\}
Hello \\$\\backslash\\$TeX\{\} and \\$\\backslash\\$LaTeX\{\}
\\$\\backslash\\$end\{document\}
,,,
GOTCHAS AND TRAPS
The error messages for LaTeX can be very cryptic.
Don't put anything above the \\$\\backslash\\$documentclass directive (such as a comment
with \\% for example), since bad things happen
LATEX DOCUMENT CLASSES
* use the "report" class for a document
>> \\$\\backslash\\$documentclass\{report\}
* common latex document classes
>> letter, report, book, article, ltxdoc
* some latex document classes
@@ ltxdoc
A classes for writing documentation about latex packages.
The title, abstract and table of contents all appear on
the same page
@@ book
A long document with chapters
@@
LATEX FILES TYPES
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some file types (by file-name extension)
.. aux - contain auxiliary information to compile a latex doc
.. dtx - a latex package file, also contains the package documentation
.. toc - contains an automatically generated table of contents
..
THE HEAD MATTER AND TITLE PAGE
* indicate the author of the document
>> preamble: \\$\\backslash\\$author\{ Donald Knuth \}
* create a multi-line author section
-----------------------------------
\\$\\backslash\\$author\{Martin Schr\\$\\backslash\\$"oder\\$\\backslash\\$\\$\\backslash\\$
5 Northland Rd\\$\\backslash\\$\\$\\backslash\\$
Bellevue Lane\\$\\backslash\\$\\$\\backslash\\$
mjjb@bumble.sf.net\\$\\backslash\\$\\$\\backslash\\$ \}
,,,
* indicate the title of the document
>> preamble: \\$\\backslash\\$title\{ The Blue Ocean \}
* indicate the date that the document was written or published
>> preamble: \\$\\backslash\\$date\{August 1, 2001\}
>> \\$\\backslash\\$date\{\\$\\backslash\\$today\} \\#\\#(use todays date instead)
* use the files modification date for the document date
>> \\$\\backslash\\$date\{\\$\\backslash\\$filedate\}
* indicate versions of the document or changes which have been made
-------------------------------------------------------------------
\\% put the most recent change last
\\$\\backslash\\$changes\{v0.90\}\{1998/05/23\}\{New\}
\\$\\backslash\\$changes\{v1.00\}\{1998/08/09\}\{Documentation improved\}
\\$\\backslash\\$changes\{v2.00\}\{1999/08/23\}\{Redesign\}
,,,
* create a document summary in the preamble
>> \\$\\backslash\\$begin\{abstract\} ... \\$\\backslash\\$end\{abstract\}
DOCUMENT TITLES ....
* make a title page
-------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$title\{testing\} \\$\\backslash\\$author\{mjb\} \\$\\backslash\\$date\{\\$\\backslash\\$today\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$maketitle
\\$\\backslash\\$end\{document\}
,,,
* make a custom title which doesnt take up a whole page
-------------------------------------------------------
\\$\\backslash\\$centerline\{\\$\\backslash\\$Large \\$\\backslash\\$bf The Blue Sea\} \\$\\backslash\\$medskip
\\$\\backslash\\$centerline\{\\$\\backslash\\$bf J Appleby\} \\$\\backslash\\$bigskip
,,,
* put a foot note in the title using \\$\\backslash\\$thanks
>> \\$\\backslash\\$title\{ The \\$\\backslash\\$textsf\{Bronte\} \\$\\backslash\\$thanks\{A sydney beach\} waves \}
* including the file version and date
>> version \\$\\backslash\\$fileversion, last revised \\$\\backslash\\$filedate
\\#\\#(These commands do not seem part of standard latex, maybe the "ltxdoc" package)
MAKING A TABLE OF CONTENTS
One of the considerable advantages of the Latex system is that the
table of contents is automatically generated from the set of section
headings, along with the section and page numbers.
* put a table of contents in a document
---------------------------------------
\\% you need to run pdflatex at least twice for the
\\% table of contents to appear
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$title\{testing\}
\\$\\backslash\\$author\{mjb\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$tableofcontents
...
\\$\\backslash\\$end\{document\}
,,,
* display only 2 levels of sections in the table of contents
>> \\$\\backslash\\$setcounter\{tocdepth\}\{2\} \\#\\#(displays sections \\& subsections)
* add a list of figures to the document
>> \\$\\backslash\\$listoffigures
* add a list of tables to the document
>> \\$\\backslash\\$listoftables
* change the font and appearance of the table of contents
>> \\$\\backslash\\$usepackage[titles]\{tocloft\} \\#\\#(see the section below)
* make the table of contents a set of links to the sections
>> \\$\\backslash\\$usepackage\{hyperref\}
>> \\$\\backslash\\$usepackage[pdftex]\{hyperref\} \\#\\#(if compiling to "pdf" format)
* put a table of contents in an oval box with appropriate spacing
--------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$setlength\\$\\backslash\\$fboxsep\{12pt\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{0.9\\$\\backslash\\$textwidth\}
\\$\\backslash\\$vspace\{0.5cm\} \\$\\backslash\\$tableofcontents \\$\\backslash\\$vspace\{0.5cm\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{center\}
...
\\$\\backslash\\$end\{document\}
,,,
MULTIPLE COLUMN TABLES OF CONTENTS ....
* create a 2 column table of contents with the "multitoc" package
>> \\$\\backslash\\$usepackage[toc]\{multitoc\}
* another way, but not recommended
----------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\} \\$\\backslash\\$tableofcontents \\$\\backslash\\$end\{multicols\}
...
\\$\\backslash\\$end\{document\}
,,,
CUSTOMIZING THE TABLE OF CONTENTS ....
@@ \url{http://www.mail-archive.com/lyx-users@lists.lyx.org/msg13159.html}
a discussion about the tocloft package
@@ \url{http://www.ctan.org/tex-archive/help/Catalogue/entries/tocloft.html}
the ctan catalogue entry for the 'tocloft' package
The tocloft package has many options for customizing the appearance and
layout of the table of contents, which is generated by the
\\$\\backslash\\$tableofcontents command, but the documentation for the package is a bit
obscure.
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents tocloft document part names
.. part, \\$\\backslash\\$part
.. chap, \\$\\backslash\\$chapter
.. sec, \\$\\backslash\\$section
.. subsec, \\$\\backslash\\$subsection
.. subsubsec, for \\$\\backslash\\$subsubsection
.. para, \\$\\backslash\\$paragraph
.. subpara, for \\$\\backslash\\$subparagraph
.. fig, figure \\$\\backslash\\$caption
.. subfig, subfigure \\$\\backslash\\$caption
.. tab, table \\$\\backslash\\$caption
.. subtab, subtable \\$\\backslash\\$caption
..
* change the font of the "section" title in the table of contents
---------------------------------------------------------------
\\$\\backslash\\$usepackage\{tocloft\}
\\$\\backslash\\$renewcommand\\$\\backslash\\$cftsecfont\{\}
,,,
* put an underline under the table of contents title
----------------------------------------------------------------
\\$\\backslash\\$usepackage\{tocloft\}
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftaftertoctitle\}\{ \\$\\backslash\\$vspace\{5pt\} \\$\\backslash\\$hrule\}
,,,
* use an asterix instead of a dot for dotted lines in the table of contents
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftdot\}\{\\$\\backslash\\$ensuremath\{\\$\\backslash\\$ast\}\}
* set the space between dots in dotted lines to 1 point
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftdotsep\}\{1pt\}
* dont show any dots
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftdotsep\}\{\\$\\backslash\\$cftnodot\}\}
* make the table of contents title Large, italic title typeset flushright
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cfttoctitlefont\}\{\\$\\backslash\\$hfill\\$\\backslash\\$Large\\$\\backslash\\$itshape\}
* set the table of contents title font to large and bold
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cfttoctitlefont\}\{\\$\\backslash\\$normalfont \\$\\backslash\\$large \\$\\backslash\\$bfseries\}
* make the list of figures title Large, italic title typeset flushright
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftloftitlefont\}\{\\$\\backslash\\$hfill\\$\\backslash\\$Large\\$\\backslash\\$itshape\}
* a centered, large, bold table of contents title
-------------------------------------------------
\\$\\backslash\\$usepackage\{tocloft\}
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$cfttoctitlefont\}\{\\$\\backslash\\$hfill\\$\\backslash\\$Large\\$\\backslash\\$bfseries\} together with
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftaftertoctitle\}\{\\$\\backslash\\$hfill\}
,,,
* set the vertical space before section entries in the toc to 0
---------------------------------------------------------------
usepackage\{tocloft\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$cftbeforesecskip\}\{0pt\}
,,,
* set the vertical space before and after the table of contents title to 0
--------------------------------------------------------------------------
usepackage\{tocloft\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$cftbeforetoctitleskip\}\{0cm\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$cftaftertoctitleskip\}\{0cm\}
,,,
* set the vertical space before list of figures title to 0
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftbeforeloftitleskip\}\{0cm\}
* set the vertical space before sub-sub-sections title to 0
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftbeforesubsubsecskip\}\{0cm\}
* remove any indentation of "subsection" entries in the toc
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftsubsecindent\}\{0cm\}
* set the width of the chapter number entries to 1cm in the table of contents
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$cftchapnumwidth\}\{1cm\}
* make the section entry page numbers italic
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftsecpagefont\}\{\\$\\backslash\\$itseries\}
* make chapters in the toc have a dotted line to the page number
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftchapleader\}\{\\$\\backslash\\$cftdotfill\{\\$\\backslash\\$cftchapdotsep\}\}
* put the text "sect:" before each sub-section entry in the table of contents
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftsubsecpresnum\}\{sub-sect:\}
* add a colon after the chapter entry number in the table of contents
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$cftchapaftersnum\}\{:\}
PARAGRAPHS
* set the first line paragraph indent to 0
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$parindent\}\{0pt\}
* set the space between each paragraph to 2 lines
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$parskip\}\{2ex\}
* set the entire paragraph indent to 1cm
>> setlength\{\\$\\backslash\\$parindent\}\{1cm\} \\$\\backslash\\$hangindent=\\$\\backslash\\$parindent
>> \\$\\backslash\\$parindent0em \\$\\backslash\\$hangindent2em \\$\\backslash\\$hangafter=0 \\#\\#(the same)
* indent an entire paragraph more than other paragraphs
>> \\$\\backslash\\$begin\{quote\} ... \\$\\backslash\\$end\{quote\}
* force a new paragraph
>> \\$\\backslash\\$par
SECTIONS AND CHAPTERS
------------------------------------------------------
A latex document can and should be divided up into various sections,
subsections, sub-subsections and so on. This is useful for organising
the document and these section types are then used to generate a table
of contents for the document automatically.
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents>> section types
.. \\$\\backslash\\$part - very large part of, say, a book
.. \\$\\backslash\\$chapter - chapter of book; not in \{article\} style
.. \\$\\backslash\\$section - section of the document
.. \\$\\backslash\\$subsection - sections then broken into subsections
.. \\$\\backslash\\$subsubsection - which can be broken into pieces
.. \\$\\backslash\\$paragraph - which can contain some ``paragraphs''
.. \\$\\backslash\\$subparagraph - which have even smaller pieces
,,,
* turn off all section numbering
>> \\$\\backslash\\$setcounter\{secnumdepth\}\{0\} \\#\\#(in the preamble)
* turn of numbering for a particular secton
>> \\$\\backslash\\$subsection*\{Strange Poetry\} \\#\\#(the section doesnt show in the toc)
* create fancy chapter headings
-------------------------------
\\$\\backslash\\$documentclass\{book\}
\\% error ???
\\%\\$\\backslash\\$usepackage[Lenny]\{fncychap\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$chapter\{Compiler Construction Tools\}
\\$\\backslash\\$end\{document\}
,,,
* possible chapter heading styles in the "fncychap" package
>> Sonny, Lenny, Glenn, Conny, Rejne and Bjarne.
* create more compact section headings with less spacing
>> \\$\\backslash\\$usepackage[small,compact]\{titlesec\}
* replace "Section 5" with s5
>> \\$\\backslash\\$def\\$\\backslash\\$Section \{\\$\\backslash\\$S\} \\#\\#(use the command "\\$\\backslash\\$Section 5")
* change the font of the "section" headings
-------------------------------------------
\\$\\backslash\\$usepackage\{sectsty\}
\\$\\backslash\\$sectionfont\{\\$\\backslash\\$LARGE\\$\\backslash\\$textit\}
,,,
* underline "section" headings
-------------------------------------------
\\$\\backslash\\$usepackage\{sectsty\}
\\$\\backslash\\$sectionrule
,,,
THE TITLESEC PACKAGE ....
@@ \url{http://tug.ctan.org/tex-archive/macros/latex/contrib/titlesec/titlesec.pdf}
documentation for the "titlesec" package, with good examples at the
end in the appendix
The title section package contains many options for customizing
section and subsection headings.
* create "section" headings with a rule above and the number on the left
* next to the rule
-------------------------------------------------------------------------
\\$\\backslash\\$usepackage\{titlesec\}
...
\\$\\backslash\\$titleformat\{\\$\\backslash\\$section\}[block]
\{\\$\\backslash\\$normalfont\\$\\backslash\\$sffamily\}
\{\\$\\backslash\\$thesection\}\{.5em\}\{\\$\\backslash\\$titlerule\\$\\backslash\\$\\$\\backslash\\$[.8ex]\\$\\backslash\\$bfseries\}
,,,
* an italic section title with rule above and the number next to the title
-------------------------------------------------------------------------
\\$\\backslash\\$titleformat\{\\$\\backslash\\$section\}
\{\\$\\backslash\\$titlerule \\$\\backslash\\$vspace\{.8ex\}\\%
\\$\\backslash\\$normalfont\\$\\backslash\\$itshape\}
\{\\$\\backslash\\$thesection.\}\{.5em\}\{\}
,,,
* create a framed "section" heading with the section number in the frame
------------------------------------------------------------------------
\\$\\backslash\\$titleformat\{\\$\\backslash\\$section\}[frame]
\{\\$\\backslash\\$normalfont\}
\{\\$\\backslash\\$filright \\$\\backslash\\$footnotesize \\$\\backslash\\$enspace SECTION \\$\\backslash\\$thesection\\$\\backslash\\$enspace\}
\{8pt\} \{\\$\\backslash\\$Large\\$\\backslash\\$bfseries\\$\\backslash\\$filcenter\}
\\% with an 8pt gap between the title and the frame
,,,
* framed "section" headings, text on the left, section no. on the right
-----------------------------------------------------------------------
\\$\\backslash\\$usepackage\{titlesec\}
\\$\\backslash\\$titleformat\{\\$\\backslash\\$section\}[frame]
\{\\$\\backslash\\$normalfont\}
\{\\$\\backslash\\$filleft \\$\\backslash\\$footnotesize \\$\\backslash\\$enspace Section \\$\\backslash\\$thesection\\$\\backslash\\$enspace\}
\{3pt\} \{\\$\\backslash\\$bfseries\\$\\backslash\\$itshape\\$\\backslash\\$filright\}
,,,
REFERENCES AND LABELS
* create a label which can then be referenced with "\\$\\backslash\\$ref"
>> \\$\\backslash\\$label\{webbook\}
* reference a label already created with "\\$\\backslash\\$label"
>> \\$\\backslash\\$ref\{webbook\}
* show the page number of a label
>> \\$\\backslash\\$pageref\{webbook\}
FOOTNOTES
* create a footnote in the normal text of the document
>> \\$\\backslash\\$footnote\{The Linux Cookbook\}
* create footnotes marked with symbols, rather than numbers
-----------------------------------------------------------
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$thefootnote\}\{\\$\\backslash\\$fnsymbol\{footnote\}\}
\\$\\backslash\\$thefootnote\{Gum Trees\}
,,,
ROTATING THINGS
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents packages which rotate
..
.. rotating
.. lscape
.. graphicx
.. rotfloat
..
@@ \url{http://statweb.calpoly.edu/jdoi/web/reference/latex.html}
side by side figures
@@ \url{http://www.perce.de/LaTeX/PDF/rotating.pdf}
extensive information about rotating things
ROTATING TEXT ....
* display text which has been rotated vertically
------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$begin\{sideways\} vertical text \\$\\backslash\\$end\{sideways\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-rotating-sideways.png \\%\\%
,,,
* rotate text by 30 degrees
------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$begin\{turn\}\{30\} turned 30 degrees \\$\\backslash\\$end\{turn\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-rotating-turn30.png \\%\\%
,,,
* rotate text by minus 30 degrees (clockwise)
--------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$begin\{turn\}\{-30\} turned -30 degrees \\$\\backslash\\$end\{turn\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-rotating-turn-minus30.png \\%\\%
,,,
* rotate text by 30 degrees anti-clockwise without adding extra space
---------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$begin\{rotate\}\{30\} rotated 30 degrees \\$\\backslash\\$end\{rotate\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-rotating-rotate30.png \\%\\%
,,,
* rotate some bold-italic text by 80 degrees anti-clockwise
-----------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$begin\{turn\}\{80\} \{\\$\\backslash\\$bfseries\\$\\backslash\\$itshape rotated \} \\$\\backslash\\$end\{turn\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-rotating-rotate30.png \\%\\%
,,,
* scale and reflect text
------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$scalebox\{2\}\{\\$\\backslash\\$reflectbox\{Scaled and Reflected\}\}
More text
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-graphicx-reflectbox.png \\%\\%
,,,
* rotate text creating extra space (a 'box' of whitespace)
----------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$rotatebox\{60\}\{Rotated 60 degrees\}
More text
\\$\\backslash\\$end\{document\}
,,,
* multiline rotated text
------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
Normal text
\\$\\backslash\\$rotatebox\{40\}\{\\%
because we \\$\\backslash\\$textbf\{cannot\} overwrite some other stuff.\\%
because we \\$\\backslash\\$textbf\{cannot\} overwrite some other stuff.\\%
\}
More text
\\$\\backslash\\$end\{document\}
,,,
ROTATING TABLES ....
* display a sideways table
--------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
\\% the sideways table always gets put on a new
\\% page, which is not what we want at all.
\\$\\backslash\\$begin\{sidewaystable\}
\\$\\backslash\\$centering
\\$\\backslash\\$begin\{tabular\}\{ l|c|r| \}
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$ 4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$ 10 \\& 11 \\& 12 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$caption\{A rotated table\}
\\$\\backslash\\$end\{sidewaystable\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-rotating-sidewaystable.png \\%\\%
,,,
ROTATING IMAGES ....
To rotate an image we can use the 'rotating' package
or just the 'graphicx' package.
* rotate an image by 45 degrees
-------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\% \\$\\backslash\\$usepackage[pdftex]\{graphicx\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
An image rotated by 45 degrees
\\$\\backslash\\$includegraphics[angle=45]\{image/tree.jpg\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-graphicx-angle45.png \\%\\%
,,,
PAGE LAYOUT AND SPACING
\\#\\# the latex default is the us letter which is slightly smaller than A4
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents latex measurement units
.. in - inches
.. mm - millimeters
.. cm - centimeters
.. pt - points (about 1/72 inch)
.. em - approximately the width of an "M" in the current font
.. ex - approximately the height of an "x" in the current font
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents less common units
.. pc - pica (12pt/pc)
.. bp - big pt (72bp/in)
.. dd - didôt (1157dd=1238pt)
.. cc - cîcero (12dd/cc)
.. sp - scaled point (65536sp/pt)
* create 1/2 a centimetre of horizontal space
>> \\$\\backslash\\$hspace\{0.5cm\}
* create a landscape oriented a4 document
>> \\$\\backslash\\$usepackage[a4paper,landscape]\{geometry\}
* use more of the page than normal with "fullpage"
pre:
\\$\\backslash\\$documentstyle[12pt,fullpage]\{article\}
* use double spacing in the document and reduce the spacing slightly
--------------------------------------------------------------------
pre:
\\$\\backslash\\$documentstyle[12pt,doublespace]\{article\}
\\$\\backslash\\$setstretch\{1.7\} \\%\\% the normal stretch is 2
,,,
* set page margins to 3cm with no header or footer space
>> \\$\\backslash\\$usepackage[margin=3cm,noheadfoot]\{geometry\} \\#\\#(in the preamble)
* set vertical and horizontal margins with the geometry package
---------------------------------------------------------------
\\$\\backslash\\$usepackage[pdftex]\{geometry\}
\\$\\backslash\\$geometry\{twoside=false,a4paper,hmargin=\{1cm,1cm\},vmargin=\{1cm,1cm\}\}
,,,
* set each of the page margins separately with no header or footer space
------------------------------------------------------------------------
pre:
\\$\\backslash\\$usepackage[left=2cm,top=1cm,right=3cm,nohead,nofoot]\{geometry\}
,,,
* fill the page with vertical whitespace
>> \\$\\backslash\\$vfill \\#\\#(the following text will be close to the bottom of the page)
LINE BREAKS ....
* force a line break to occur at the end of a line
>> \\$\\backslash\\$\\$\\backslash\\$ or \\$\\backslash\\$linebreak \\#\\#("\\$\\backslash\\$\\$\\backslash\\$" may produce an error if there is no line to break)
* create a line break with half a centimetre of vertical space
>> \\$\\backslash\\$\\$\\backslash\\$[0.5cm]
SAVING SPACE AND PAPER ....
@@ \url{http://gurmeetsingh.wordpress.com/2008/09/20/latex-tips-n-tricks-for-conference-papers/}
some tips on saving paper
* create more compact section headings with less spacing
>> \\$\\backslash\\$usepackage[small,compact]\{titlesec\}
* use the times package to save space
>> \\$\\backslash\\$usepackage\{times\}
* create more compact tables of contents
>> \\$\\backslash\\$usepackage\{tocloft\} \\#\\#(see the relevant section)
>> \\$\\backslash\\$usepackage\{multitoc\} \\#\\#(for a 2 colun toc, see the section)
* reduce the size of captions
>> \\$\\backslash\\$usepackage[small,it]\{caption\}
* create more compact and nicer enumerated and definition lists
---------------------------------------------------------------
\\$\\backslash\\$usepackage\{enumitem\}
,,,
MULTIPLE COLUMNS
* create a page with two columns with a 1pt width rule and 15pt separation
--------------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnseprule\}\{1pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnsep\}\{15pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\}
blah...blah
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-multicol-columnsep.png \\%\\%
,,,
* create a 3 column section with a section heading which spans all columns
--------------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnseprule\}\{1pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnsep\}\{15pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{3\}[\\$\\backslash\\$section\{The User Interface\}]
blah...blah
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-multicol-span3.png \\%\\%
,,,
* immediately break a column with 'columnbreak'
-----------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnseprule\}\{1pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\}
This text is in the 1st Column
\\$\\backslash\\$columnbreak
\\% the following blank line is necessary for the
\\% columnbreak command to work
But this text should be in the 2nd
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-multicol-columnbreak.png \\%\\%
,,,
* some text in the 1st column, and an image in the 2nd
------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol, graphicx\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnseprule\}\{1pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnsep\}\{15pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\}
blah...blah
\\$\\backslash\\$columnbreak
\\$\\backslash\\$includegraphics\{image/tree.jpg\}
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-multicols-columnbreak-image.png \\%\\%
,,,
* a code listing in the 1st column, and an image in the 2nd
------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol, graphicx\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$lstset\{basicstyle=\\$\\backslash\\$ttfamily, numbers=left, frame=single\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnseprule\}\{1pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$columnsep\}\{15pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\}
\\% the 'breakline' option is necessary to stop the
\\% code spilling into the next column
\\%
\\$\\backslash\\$begin\{lstlisting\}[breaklines=true]
for i = 1 to 20 print why is this so; end
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$columnbreak
\\$\\backslash\\$includegraphics\{image/tree.jpg\}
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{document\}
,,,
* create a 2 column table of contents
-------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{multicols\}\{2\} \\$\\backslash\\$tableofcontents \\$\\backslash\\$end\{multicols\}
....
\\$\\backslash\\$end\{document\}
,,,
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents Multicol package options
.. \\$\\backslash\\$raggedcolumns - dont align the bottoms of the columns
.. \\$\\backslash\\$columnbreak - immediately start the next column
..
NEWSPAPER STYLE DOCUMENTS
* create a newspaper type of document
>> \\$\\backslash\\$usepackage\{paperTex\}
LISTS
\\#\\# By default 4 levels of list nesting is allowed in LaTeX
* create a bullet list (similar to HTML
)
-------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{itemize\}
\\$\\backslash\\$item First item
\\$\\backslash\\$item Second item
\\$\\backslash\\$item Second item
\\$\\backslash\\$end\{itemize\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-itemize.png \\%\\%
,,,
* label a bullet list with stars instead of bullets
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$labelitemi\}\{\\$\\$\\backslash\\$star\\$\}
* display a numbered or enumerated list
---------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{enumerate\}
\\$\\backslash\\$item First item
\\$\\backslash\\$item Second item
\\$\\backslash\\$item Third item
\\$\\backslash\\$end\{enumerate\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-enumerate.png \\%\\%
,,,
* use uppercase letters for level 1 and lower case letters for level 2 lists
----------------------------------------------------------------------------
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$labelenumi\}\{\\$\\backslash\\$Alph\{enumi\}\}
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$labelenumii\}\{\\$\\backslash\\$alph\{enumii\}\}
,,,
DEFINITION OR DESCRIPTION LISTS ....
\\# A definition or description list consists of a set of terms
\\# and a related description or definition.
* make a "description" list (similar to html )
--------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{description\}
\\$\\backslash\\$item[trees] producers of oxygen
\\$\\backslash\\$item[animal] producers of gas
\\$\\backslash\\$item[plant] greenery
\\$\\backslash\\$end\{description\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-description-list.png \\%\\%
,,,
* put urls within the \\$\\backslash\\$item section of a definition list
--------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{url\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{description\}
\\$\\backslash\\$item[\\$\\backslash\\$url\{http://www.stdout.org/\\$\\verb|~|winston/latex/\}]
a cheat-sheet for latex
\\$\\backslash\\$item[\\$\\backslash\\$url\{http://www.ctan.org/\}]
the official site for TeX and Latex
\\$\\backslash\\$end\{description\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-description-list-url.png \\%\\%
,,,
* put links within the \\$\\backslash\\$item section of a definition list
--------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{description\}
\\% to create clickable urls \\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$item[\\$\\backslash\\$url\{http://www.stdout.org/\\$\\verb|~|winston/latex/\}]
a cheat-sheet for latex
\\$\\backslash\\$item[\\$\\backslash\\$url\{http://www.ctan.org/\}]
the official site for TeX and Latex
\\$\\backslash\\$end\{description\}
,,,
* make more compact lists
-------------------------
pre:
\\$\\backslash\\$usepackage\{paralist\}
body:
,,,
THE ENUMITEM PACKAGE FOR LISTS ....
* more compact lists with "enumitem" package by the author of "titlesec"
@@ \url{http://www.tex.ac.uk/tex-archive/macros/latex/contrib/enumitem/enumitem.pdf}
documentation for the "enumitem" package
@@ \url{http://www.tex-tipografia.com/enumitem.html}
home page of the package author
* create a list with less item separation but with indentation
--------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{enumitem\}
\\$\\backslash\\$setlist\{noitemsep\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{enumerate\}[labelindent=\\$\\backslash\\$parindent,leftmargin=*]
\\$\\backslash\\$item A deluded knight,
\\$\\backslash\\$item as thin as a greyhound,
\\$\\backslash\\$item tilting at windmills
\\$\\backslash\\$end\{enumerate\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.25 image/eg-enumitem-noitemsep.png \\%\\%
,,,
* a list with the number labels boxed
-------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{enumitem\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{enumerate\}[label=\\$\\backslash\\$fbox\{\\$\\backslash\\$arabic*\}]
\\$\\backslash\\$item A deluded knight,
\\$\\backslash\\$item as thin as a greyhound,
\\$\\backslash\\$item tilting at windmills
\\$\\backslash\\$end\{enumerate\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-enumitem-box.png \\%\\%
,,,
* a description list with descriptions on the next line indented 1 cm
---------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{enumitem\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{description\}
[font=\\$\\backslash\\$sffamily\\$\\backslash\\$bfseries, leftmargin=1cm, style=nextline]
\\$\\backslash\\$item[Concepts] the ideas which have been developed,
\\$\\backslash\\$item[Second Point] an in depth elaboration,
\\$\\backslash\\$item[Final matter] the conclusion of the list.
\\$\\backslash\\$end\{description\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-enumitem-gloss.png \\%\\%
,,,
* a definition list, indented by the same as the paragraph with
* definitions indented 2cm and placed on the next line
-----------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{enumitem\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{description\}
[labelindent=\\$\\backslash\\$parindent, leftmargin=2cm, style=nextline]
\\$\\backslash\\$item[Concepts] the ideas which have been developed,
\\$\\backslash\\$item[Second Point] an in depth elaboration,
\\$\\backslash\\$end\{description\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-enumitem-indent.png \\%\\%
,,,
CREATING A NEW LIST COMMAND ....
* create a new command for a compact list which takes up less space
-------------------------------------------------------------------
\\$\\backslash\\$newcommand\{\\$\\backslash\\$compactlist\}\{
\\$\\backslash\\$begin\{list\}\{\\$\\$\\backslash\\$bullet\\$\} \{
\\$\\backslash\\$setlength\{\\$\\backslash\\$itemsep\}\{0pt\} \\$\\backslash\\$setlength\{\\$\\backslash\\$parsep\}\{3pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$topsep\}\{3pt\} \\$\\backslash\\$setlength\{\\$\\backslash\\$partopsep\}\{0pt\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$leftmargin\}\{1.5em\} \\$\\backslash\\$setlength\{\\$\\backslash\\$labelwidth\}\{1em\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$labelsep\}\{0.5em\}
\}
\}
\\$\\backslash\\$newcommand\{\\$\\backslash\\$compactlistend\}\{
\\$\\backslash\\$end\{list\} \}
,,,
* use the new compact list
--------------------------
\\$\\backslash\\$compactlist
\\$\\backslash\\$item First item
\\$\\backslash\\$item Second item
\\$\\backslash\\$compactlistend
,,,
LATEX FONTS
@@ \url{http://www.tug.dk/FontCatalogue/}
A catalogue with examples of fonts which are normally
available on a Latex distribution.
@@ \url{http://www.tug.org/pracjourn/2006-1/schmidt/schmidt.pdf}
A paper about font selection
@@ \url{http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/fonts.html}
basic tex font information
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents the 3 styles within a font family
.. font family -
.. font shape -
.. font series -
..
* find out where some "standard" fonts are for pdflatex
>> sudo find /* -name "psnfss" | less
* list some standard font packages for a "tetex" latex distribution
>> ls \texttt{/usr/share/texmf-tetex/tex/latex/psnfss/*.sty}
\\#\\#(these packages can be used with "\\$\\backslash\\$usepackage\{name\}" without the ".sty")
* use a standard psnfss font package
>> \\$\\backslash\\$usepackage\{helvet\}
FONT TYPES ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some typically installed font families
.. times, Times, Helvetica, Courier
.. pslatex, This is preferred over Times because of the way it handles Courier.
.. newcent, New Century Schoolbook, Avant Garde, Courier
.. palatino, Palatino, Helevetica, Courier
.. palatcm, changes the Roman to Palatino only, but uses CM mathematics
.. helvet,
..
* use the "bookman" font in the document
>> \\$\\backslash\\$usepackage\{bookman\}
\\#\\#(this changes only the roman font, not monospace, or sans serif)
* display "very" in italics and the rest of the text in normal font
>> It's \\$\\backslash\\$textit\{very\} provoking
>> It's \\$\\backslash\\$em very \\$\\backslash\\$rm provoking \\#\\#(the old latex version)
* display only the word "very" in fixed pitch font
>> It is \\$\\backslash\\$texttt\{very\} blue
* The old form of the font type names was "\\$\\backslash\\$tt", "\\$\\backslash\\$it" etc
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents latex font type names
.. \\$\\backslash\\$emph - (LaTeX2e emphasis command)
.. \\$\\backslash\\$textrm, \\$\\backslash\\$rm - Roman.
.. \\$\\backslash\\$textit, \\$\\backslash\\$it - Italics.
.. \\$\\backslash\\$textem, \\$\\backslash\\$em - Emphasis (toggles between \\$\\backslash\\$it and \\$\\backslash\\$rm).
.. \\$\\backslash\\$textbf, \\$\\backslash\\$bf - Boldface.
.. \\$\\backslash\\$textsl, \\$\\backslash\\$sl - Slanted.
.. \\$\\backslash\\$textsf, \\$\\backslash\\$sf - Sans serif.
.. \\$\\backslash\\$textsc, \\$\\backslash\\$sc - Small capital letters.
.. \\$\\backslash\\$texttt, \\$\\backslash\\$tt - fixed pitch 'typewriter' font
..
* emphasise text
>> this \\$\\backslash\\$emph\{is emphasised\}
* display "a big forest" in bold, italic, sanserif font
>> walking in \{\\$\\backslash\\$bfseries\\$\\backslash\\$itshape\\$\\backslash\\$sffamily a big forest\}
* display "tree" in bold, italic
>> the green \{\\$\\backslash\\$bfseries\\$\\backslash\\$itshape tree\}
>> the green \\$\\backslash\\$textbf\{\\$\\backslash\\$textit\{tree\}\} \\#\\#(the same)
* displays "the tree" in small capital text
>> small capitals: \\$\\backslash\\$textsc\{the tree\} \\#\\#(small cap)
[= image/eg-textsc.png]
FONT SIZE ....
* make some text large
>> Some \{\\$\\backslash\\$LARGE large text\} here
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents latex font sizes
.. \\$\\backslash\\$tiny, 5pt
.. \\$\\backslash\\$scriptsize, 7pt
.. \\$\\backslash\\$footnotesize, 8pt
.. \\$\\backslash\\$small, 9pt
.. \\$\\backslash\\$normalsize, 10pt
.. \\$\\backslash\\$large, 12pt
.. \\$\\backslash\\$Large, 14pt 14.40pt
.. \\$\\backslash\\$LARGE, 18pt, 17.28pt
.. \\$\\backslash\\$huge, 20pt 20.74pt
.. \\$\\backslash\\$Huge, 24pt 24.88pt
..
* use relative font sizes
-------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{relsize\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$medskip
\\$\\backslash\\$textsc\{isbn 90-6464-659-7\}
\\$\\backslash\\$bigskip
\\$\\backslash\\$smaller Author
\\$\\backslash\\$end\{document\}
,,,
URLS AND HYPERLINKS
@@ \url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL}
The tex faq about typesetting URLs
@@ \url{http://www.kronto.org/thesis/tips/url-formatting.html}
Using the "url" package in footnotes
* packages: url, hyperref
* format URLs in documents
-------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{url\}
\\$\\backslash\\$begin\{document\}
see the website
\\$\\backslash\\$url\{http://bumble.sf.net/books/\\$\\verb|~|who\\#this?is\\%20\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-url.png \\%\\%
,,,
\\# The \\$\\backslash\\$url can contain LaTeX special characters "\\# \\% \\^ \\& \\$\\verb|~| \\_ \\$"
\\# but '\\$\\backslash\\$' must be escaped and "\{" "\}" seem to be completely fatal.
THE HYPERREF PACKAGE ....
@@ \url{http://www.laqee.unal.edu.co/tex-archive/macros/latex/contrib/hyperref/doc/manual.html}
manual for the "Hyperref" package in html format
@@ \url{http://en.wikibooks.org/wiki/LaTeX/Hyperlinks}
about the hyperref package
@@ \url{http://www.math.uakron.edu/\\$\\verb|~|dpstory/tutorial/pdfmarks/hyper.pdf}
a nicely formatted pdf article about using colour and hyperlinks
@@ \url{http://www.mpch-mainz.mpg.de/\\$\\verb|~|joeckel/pdflatex/}
hints for using the hyperref package
* put \\$\\backslash\\$usepackage\{hyperref\} LAST in the package list
* The hyperref package automatically turns the table of contents into links
* labels created with "\\$\\backslash\\$label" are also turned into clickable links
* use coloured hyperlinks (instead of a coloured box around the link)
--------------------------------------------------------------------
\\$\\backslash\\$usepackage[colorlinks=true, linkcolor=green, filecolor=red,
citecolor=red, urlcolor=green]\{hyperref\}
,,,
* make a clickable hyperlink in a pdf document
----------------------------------------------
pre: \\$\\backslash\\$usepackage[pdftex]\{hyperref\}
body: \\$\\backslash\\$href\{URL\}
,,,
\\#\\#(the option "pdftex" is for compiling with "pdfLatex")
* make a clickable hyperlink which has a display text not the URL
-----------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$begin\{document\}
click this \\$\\backslash\\$href\{URL\}\{text\}
\\$\\backslash\\$end\{document\}
,,,
* make a clickable hyperlink which displays the url in fixed pitch font
-----------------------------------------------------------------
pre: \\$\\backslash\\$usepackage\{hyperref\}
body: \\$\\backslash\\$url\{URL\}
,,,
* put a greenish border around links in the file (the default in red)
----------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[linkbordercolor=\{0 1 0\}]\{hyperref\}
\\$\\backslash\\$begin\{document\}
A page: \\$\\backslash\\$url\{http://xx.org/book/doc.html\\#chap1\}
\\$\\backslash\\$end\{document\}
,,,
\\#\\#(the border color is in the format \{red green blue\} )
* indicate pdf document information with the "hyperref" package
---------------------------------------------------------------
\\$\\backslash\\$usepackage
[pdftitle=\{Using LaTeX to Create Quality PDF Documents\},
pdfauthor=\{D. P. Story\},
pdfsubject=\{How to use hyperref, color packages\},
pdfkeywords=\{LaTeX hyperref pdf\}]\{hyperref\}
,,,
* it is possible to set package options with
>> \\$\\backslash\\$hypersetup\{option=value, ...\}
* create a pdf with an Acrobat "bookmarks" tab which is initially open
----------------------------------------------------------------------
\\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$hypersetup\{pdftex, bookmarks=true, pdfpagemode=UseOutlines\}
,,,
\\#\\#(the "pdftex" option indicates that the "pdflatex" compiler will be used)
* create a pdf with a "bookmarks" tab open and the bookmarks "expanded"
----------------------------------------------------------------------
\\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$hypersetup\{pdftex, bookmarks=true, bookmarksopen=true,
pdfpagemode=UseOutlines\}
,,,
* create a pdf with a "bookmarks" tab closed and the bookmarks "unexpanded"
----------------------------------------------------------------------
\\$\\backslash\\$usepackage\{hyperref\}
\\$\\backslash\\$hypersetup\{pdftex, bookmarks=true, bookmarksopen=false,
pdfpagemode=None\}
,,,
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some "hyperref" package options
..
.. ps2pdf - required for LaTeX -> dvips -Ppdf -> ps2pdf
.. pdftex - required for pdfLaTeX
.. bookmarks=true - generates bookmarks for entries in the table of contents
.. bookmarksnumbered=true - includes section numbers in the "Table of Contents".
.. hypertexnames=false - necessary to get the hyper-links to the figures right?
.. breaklinks=true - allows hyper-references (links) exceeding a single line
.. linkbordercolor=\{0 0 1\} - but blue frames around the linksj
.. pdfborder=\{0 0 112.0\} - (set width of frames in pixels)
.. pdfpagemode=None - the section list in the "bookmarks" tab is unexpanded
.. pdfpagemode=UseOutlines - the list in the "bookmarks" tab is expanded
..
COLOURS
@@ \url{http://www.ukern.de/tex/xcolor.html}
the home page for the "xcolor" package
@@ \url{http://www.tex.ac.uk/tex-archive/macros/latex/contrib/xcolor/xcolor.pdf}
documentation for xcolor
A colour model is a way of describing colours suitable
to a particular output device.
\\#\\# generally colour names must be defined before using them
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents color packages
.. color - allow color definitions and 7 built in colours
.. xcolor - many more colour options
.. chroma - uses xcolor
..
* documentation for the "color" package
>> grfguide.dvi
* predefined colours with the "color" package
>> black, white, red, green, blue, cyan, magenta and yellow
* when compiling with pdftex it may be better to use
>> \\$\\backslash\\$usepackage[pdftex]\{color\}
* display some text in a pinkish colour
---------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$definecolor\{pink\}\{rgb\}\{1,0.5,0.5\}
\\$\\backslash\\$begin\{document\}
Testing text \\$\\backslash\\$textcolor\{pink\}\{colours\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-color-textcolor.png \\%\\%
,,,
* define a lightgrey colour using the "gray" colour model
>> \\$\\backslash\\$definecolor\{light-gray\}\{gray\}\{0.95\}
* define an orangy colour using the "Cyan, Magenta, Yellow, Black" colour model
>> \\$\\backslash\\$definecolor\{orange\}\{cmyk\}\{0,0.5,1,0\}
* define a more pleasant looking green than the default
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$definecolor\{webgreen\}\{rgb\}\{0,.5,0\}
\\$\\backslash\\$begin\{document\}
...
,,,
* define a more pleasant looking brown than the default
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$definecolor\{webbrown\}\{rgb\}\{.6,0,0\}
\\$\\backslash\\$begin\{document\}
,,,
* display the text "point." in a yellow box with no border
----------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$colorbox\{yellow\}\{point.\} \\% the text colour is black
,,,
COLOUR BOXES ....
* display the text "Tree" in a green box with a blue border
-----------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$begin\{document\}
Testing boxes: \\$\\backslash\\$fcolorbox\{blue\}\{green\}\{Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-color-fcolorbox-simple.png \\%\\%
,,,
* display the text "Tree" in a pale green box with a blue border
-----------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\% using xcolor allow more control over the colours
\\$\\backslash\\$usepackage\{xcolor\}
\\$\\backslash\\$begin\{document\}
An xcolor box: \\$\\backslash\\$fcolorbox\{blue!80\}\{green!25\}\{Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-fcolorbox-simple.png \\%\\%
,,,
* change the width of the border of the box to 2.5 points
---------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$fboxrule\}\{2.5pt\}
The Box Frame Width: \\$\\backslash\\$fcolorbox\{blue!25\}\{green\}\{Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-xcolor-fboxrule.png \\%\\%
,,,
THE XCOLOR PACKAGE
@@ \url{http://www.ukern.de/tex/xcolor.html}
some info about the xcolor package
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents colour models
.. Pantone - a proprietary model
.. hks - another proprietary model
.. rgb - red green blue
.. html - a version of 'rgb' 6 letters long
.. hsb - hue saturation brightness
.. thsb - tuned hsb
.. cmyk - cyan magenta yellow ?
.. cmy - cyan magenta yellow,
.. gray - greyscale
.. wave - visible wavelength of light 400–750 nm
..
BASIC USAGE ....
* set the text colour to be 40\\% green and 60\\% yellow
>> \\$\\backslash\\$color\{green!40!yellow\})
* display the text 'big' with a colour defined with the cmy model
-----------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$textcolor[cmy]\{0.9,0.9,0.3\}\{big\}
\\$\\backslash\\$end\{document\}
,,,
* display some text with one word coloured and the others black
---------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{xcolor\}
\\$\\backslash\\$begin\{document\}
some \\$\\backslash\\$textcolor\{blue!30!yellow\}\{coloured\} text
\\$\\backslash\\$end\{document\}
\\%\\% =@ image/eg-xcolor-textcolor \\%\\%
,,,
* print 'foo' in a pale greeny colour using an 'html' definition
>> \\$\\backslash\\$textcolor[HTML]\{AFFE90\}\{foo\} \\#\\#(html is a type of 'rgb')
* use the colour which is light-waves of 485 nano meters
>> \\$\\backslash\\$color[wave]\{485\}
* set the text colour to be 50\\% red, 20\\% green, 30\\% blue
---------------------------------------------------
\\$\\backslash\\$color\{red!50!green!20!blue\}
,,,
LINKS AND HYPERREFERENCES ....
* use the xcolor package with the hyperref package
>> \\$\\backslash\\$usepackage[hyperref]\{xcolor\}
* define the url color to be the complement of 50\\% green
>> \\$\\backslash\\$hypersetup\{urlcolor=-green!50\}
COMPLEMENTARY COLOURS ....
* use the colour which is complementary to 40\\% green, 60\\% yello
>> \\$\\backslash\\$color\{-green!40!yellow\}
* print the text 'flower' in the complement of the text colour
>> \\$\\backslash\\$textcolor\{-.\}\{flower\}
INTENSITY ....
* print 'tree' at 50\\% intensity in the current text colour
>> \\$\\backslash\\$textcolor\{.!50\}\{tree\}
* define a colour that dimishes in intensity
>> \\$\\backslash\\$def\\$\\backslash\\$Test\{\\$\\backslash\\$color\{.!80\}Test\}
>> \\$\\backslash\\$textcolor\{blue\}\{\\$\\backslash\\$Test\\$\\backslash\\$Test\\$\\backslash\\$Test\\$\\backslash\\$Test\\$\\backslash\\$Test\}
DEFINING COLOURS ....
* redefine the colour 'red' using the red, green, blue model
>> \\$\\backslash\\$definecolor\{red\}\{rgb\}\{1,0,0\}
* define a 'red' colour using either 'rgb' or 'cmyk' model
>> \\$\\backslash\\$definecolor\{red\}\{rgb/cmyk\}\{1,0,0/0,1,1,0\}
* like above but translate to hsb
>> \\$\\backslash\\$definecolor\{red\}\{hsb:rgb/cmyk\}\{1,0,0/0,1,1,0\},
* define 3 colours in one go
>> \\$\\backslash\\$definecolorset\{rgb\}\{\}\{\}\{red,1,0,0;green,0,1,0;blue,0,0,1\}
* define a colour which has 2 thirds the intensity of another
>> \\$\\backslash\\$definecolor\{new\} \\$\\backslash\\$color\{new!75\}
MIXING COLOURS ....
* mix 4 parts of red with 2 of green and 1 of yellow
>> \\$\\backslash\\$color\{rgb:red,4;green,2;yellow,1\}.
* display text in yellow in the red, green, blue colour model
>> \\$\\backslash\\$color\{rgb:yellow,1\}
CALCULATING COLOURS ....
* save the current text colour with the name 'cur'
>> \\$\\backslash\\$colorlet\{cur\}\{.\}
* define and use a 'colorseries' (a set of colours)
---------------------------------------------------
\\$\\backslash\\$definecolorseries\{foo\}\{rgb\}\{last\}\{red\}\{blue\}
\\$\\backslash\\$resetcolorseries[10]\{foo\}
\\$\\backslash\\$color\{foo!!+\} \\% access the next colour in the series
,,,
COLOUR MODELS ....
* set all colour values to use the 'cmyk' colour model
>> \\$\\backslash\\$usepackage[cmyk]\{xcolor\}
>> \\$\\backslash\\$selectcolormodel\{cmyk\} \\#\\#(the same)
* mix 50 percent yellow with the current text colour and print 'big'
>> \\$\\backslash\\$textcolor\{yellow!50!.\}\{big\}
* print a row of test colours with values
-----------------------------------------
\\$\\backslash\\$begin\{testcolors\}[rgb,cmyk,hsb,HTML,gray]
\\$\\backslash\\$testcolor\{olive\}
\\$\\backslash\\$testcolor\{red!50!green\} \\% this is the same color
\\$\\backslash\\$end\{testcolors\}
,,,
TEST COLOURS ....
* display a table of test colours and values
--------------------------------------------
\\$\\backslash\\$sffamily
\\$\\backslash\\$begin\{testcolors\}[rgb,cmyk,hsb,HTML,gray]
\\$\\backslash\\$testcolor\{olive\}
\\$\\backslash\\$testcolor\{red!50!green\}
\\$\\backslash\\$testcolor\{-cyan!50!magenta\}
\\$\\backslash\\$testcolor[cmyk]\{0,0,1,0.5\}
\\$\\backslash\\$testcolor[cmyk]\{0,0,.5,.5\}
\\$\\backslash\\$testcolor[rgb:cmyk]\{0,0,.5,.5\}
\\$\\backslash\\$end\{testcolors\}
,,,
MATHEMATICAL EQUATIONS
* typeset a mathematical equation with a label
----------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{equation\}
\\$x\\^2+y\\^2=1\\$
\\$\\backslash\\$label\{eq:xxyyeq1\}
\\$\\backslash\\$end\{equation\}
\\$\\backslash\\$end\{document\}
,,,
VERBATIM TEXT
* display verbatim text
>> \\$\\backslash\\$verb/\\_\{\}\\$\\^/ \\#\\#(will print "\\_\{\}\\$\\^")
>> \\$\\backslash\\$verb|\\_\{\}\\$\\^| \\#\\#(this is the same, any character can be used to delimit)
>> \\$\\backslash\\$verb*\\_\{\}\\$\\^* \\#\\#(the same again, but this gives me an error ?)
* watch out, you can't put a \\$\\backslash\\$verb command in a macro command
>> \\$\\backslash\\$section\{\\$\\backslash\\$verb=\\$\\verb|~|=\} \\#\\#(this produces an Error!)
>> \\$\\backslash\\$item[\\$\\backslash\\$verb=\\$\\verb|~|=] \\#\\#(so does this)
* display multiline verbatim text
---------------------------------
\\$\\backslash\\$begin\{verbatim\}
this text is \\$ verbatim
\\$\\backslash\\$end\{verbatim\}
,,,
* display quoted verbatim text
------------------------------
\\$\\backslash\\$begin\{quote\}
\\$\\backslash\\$begin\{verbatim\} ... \\$\\backslash\\$end\{verbatim\}
\\$\\backslash\\$end\{quote\}
,,,
LATEX SPECIAL CHARACTERS
* display text within curly quotes
>> ``Text between curly quotes''
* escaping special character with \\$\\backslash\\$verb|...| causes problems within other commands
* these are the main special characters
>> \\#\\^\{\}\\$\\$\\verb|~|\\$\\backslash\\$\\_\\%\\&
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents latex special characters
.. \\$\\backslash\\$, The command character, \\$\\$\\backslash\\$backslash\\$ \\$\\backslash\\$textbackslash
.. \\$, Math typesetting delimiter, \\$\\backslash\\$\\$
.. \\%, The comment character, \\$\\backslash\\$\\%
.. \\^, Math superscript character, \\$\\backslash\\$\\^
.. \\^, Actual carrot, \\$\\backslash\\$\\^\{\}, \\$\\backslash\\$verb*\\^*
.. \\&, Tabular column separator, \\$\\backslash\\$\\&
.. \\_, Math superscript character, \\$\\backslash\\$\\_
.. \\$\\verb|~|, Non-breaking space; to put the tilde over a letter, \\$\\backslash\\$verb*\\$\\verb|~|*jdoe
.. \\$\\verb|~|, Actual tilde character, \\$\\backslash\\$\\$\\verb|~|\{\}, \\$\\$\\backslash\\$sim\\$ \\$\\backslash\\$textasciitilde
.. \\#, Macro parameter symbol, \\$\\backslash\\$\\#
.. \{, Argument start delimiter, \\$\\$\\backslash\\$\{\\$
.. \}, Argument end delimiter, \\$\\$\\backslash\\$\}\\$
,,,
* if there is an unescaped "\\#" somewhere in the document you may get the message
>> Illegal parameter number in definition of \\$\\backslash\\$Hy@tempa
\\#\\#(this is nice and cryptic)
LATEX SPECIAL SYMBOLS
@@ \url{http://newton.ex.ac.uk/research/qsystems/people/sque/symbols/}
a list of maths symbols and their html entity equivalent
@@ \url{http://www.eng.cam.ac.uk/help/tpl/textprocessing/latex\\_advanced/node14.html}
a list of symbols which can be used
@@ \url{http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf}
a comprehensive list of symbols
@@ \url{http://stackoverflow.com/questions/256457/how-does-one-insert-a-backslash-or-a-tilde-into-latex}
some good advice
* To display math mode symbols use
>> \\$...\\$ or \\$\\backslash\\$begin\{math\} ... \\$\\backslash\\$end\{math\}
* display a greek beta character in the text
>> \\$\\$\\backslash\\$beta\\$ \\#\\#(the "\\$" signs put latex into math mode)
* disply an English "pound" sign
>> \\$\\backslash\\$pounds \\#\\#(the "\\$" signs are not needed because its not a math mode command)
* to follow a symbol command with a space use an extra "\\$\\backslash\\$"
>> \\$\\backslash\\$LaTeX\\$\\backslash\\$
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents non-math mode symbol commands
..
.. \\$\\backslash\\$dtag - a dagger
.. \\$\\backslash\\$TeX\\$\\backslash\\$ - the "TeX" logo with an extraspace
.. \\$\\backslash\\$LaTeX\\$\\backslash\\$ - the "TeX" logo with an extraspace
.. \\$\\backslash\\$ddag - a double dagger
.. \\$\\backslash\\$S - a section symbol
.. \\$\\backslash\\$pounds - an English pound sterling sign
.. \\$\\backslash\\$copyright - a copyright symbol
.. \\$\\backslash\\$"\{o\} - an "o" with an umlaut above it
..
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents math mode symbol commands
..
.. \\$\\backslash\\$dots - three dots in a row, an "elipsis"
.. \\$\\backslash\\$Rightarrow - a doubled right pointing arrow symbol
.. \\$\\backslash\\$rightarrow - a single right pointing arrow symbol
.. \\$\\backslash\\$clubsuit - a clubs symbol
.. \\$\\backslash\\$approx - approximately equal to (a wavy equal sign)
.. and many more
..
WHITE SPACE
UNICODE AND FOREIGN LANGUAGES
deb: latex-cjk
* xelatex
JAPANESE ....
I never really got the 'cjk' packages working, but I believe that
the 'xelatex' compiler (as opposed to the 'pdflatex' tool) should
solve many unicode text problems.
@@ \url{http://blogs.fsfe.org/ciaran/?p=150}
this is the answer.
@@ \url{http://www-alg.ist.hokudai.ac.jp/\\$\\verb|~|jan/japfonts.html}
some advice about cjk with an example document
@@ \url{http://tug.org/TUGboat/Articles/tb18-3/cjkintro600.pdf}
an article about using the cjk package
@@ \url{http://www.math.nus.edu.sg/aslaksen/cs/cjk.html}
* an example document with Japanese. Encoded in euc-jp character set
----------------------------------------------
\\$\\backslash\\$documentclass[12pt]\{scrartcl\}
\\$\\backslash\\$usepackage\{CJK\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{CJK*\}[dnp]\{JIS\}\{min\}
\\$\\backslash\\$section\{What I learned today\}
I can write this 私はキランです in Japanese.
\\$\\backslash\\$end\{CJK*\}
\\$\\backslash\\$end\{document\}
,,,
* documents need to be encoded as euc-jp
>> recode utf8..eucjp test.tex
>> iconv \\#\\#(an older tool)
* change the character encoding without affecting the original file
>> recode utf8..eucjp < test.tex > test.euc.tex
* recode from the local character set to eucjp
>> recode ..eucjp test.tex
* generate the pdf file with kanji
>> pdflatex test.tex
IMAGES
-------------------------------------------------------
When you compile a latex document with "pdflatex" the images must be
one of the formats jpeg, png or pdf. If the image file does not exist
pdflatex goes into an annoying loop asking for a new image filename
and refusing to exit (use '-interaction batchmode' to stop this)
* the image file name extension may not be necessary
>> \\$\\backslash\\$includegraphics\{eg\} \\#\\#(includes 'eg.png' etc\}
>> \\$\\backslash\\$includegraphics\{eg.png\} \\#\\#(the same, but less ambiguous)
* If '\\$\\backslash\\$usepackage\{graphicx\}' is not included in the preamble, youll get
>> !Undefined control sequence.
>> l.9 \\$\\backslash\\$includegraphics \\#\\#(or something similar)
* convert an image 'eg.gif' to a "png" image with imagemagick convert
>> convert eg.gif eg.png \\#\\#('eg.png' can now be used with pdflatex)
When compiling with 'latex' (as opposed to 'pdflatex') images must be
in the 'eps' format (encapsulated postscript)
* include an image 'tree.jpg' and at 1/2 of its original size,,
-----------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
\\% the images display side by side
\\$\\backslash\\$includegraphics[scale=0.5]\{image/tree.jpg\}
\\$\\backslash\\$includegraphics\{image/tree.jpg\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.4 image/eg-graphicx-scale.png \\%\\%
,,,
* include an image taking up 2 thirds of the current page width
---------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\} ...
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$includegraphics[width=0.75\\$\\backslash\\$textwidth]\{image/test.jpg\}
\\$\\backslash\\$end\{document\}
,,,
* display an image 1/2 its normal size and upside down
>> \\$\\backslash\\$includegraphics[scale=0.5, angle=180]\{chick\}
* create a box around the image 'eg.jpg'
---------------------------------------
\\$\\backslash\\$setlength\\$\\backslash\\$fboxsep\{0pt\}
\\$\\backslash\\$setlength\\$\\backslash\\$fboxrule\{0.5pt\}
\\$\\backslash\\$fbox\{\\$\\backslash\\$includegraphics\{eg\}\}
,,,
* tell latex to look for images in the folder "/var/lib/images"
>> \\$\\backslash\\$graphicspath\{\{/var/lib/images/\}\}
* float an image to the right, taking up half the page, with a
* caption at the bottom,,
-------------------------
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage\{wrapfig, graphicx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{wrapfigure\}\{r\}\{0.5\\$\\backslash\\$textwidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$includegraphics[width=0.45\\$\\backslash\\$textwidth]\{image/tree.jpg\}
\\$\\backslash\\$caption\{The image caption\}
\\$\\backslash\\$end\{wrapfigure\}
This is some example text which will wrap around the image ...
This is some example text which will wrap around the image ...
This is some example text which will wrap around the image ...
This is some example text which will wrap around the image ...
\\$\\backslash\\$end\{document\}
,,,
Notes:
The 'wrapfigure' textwidth is slightly greater than the
'includegraphics' textwidth to ensure some space between the image
and the surrounding text.
the \\$\\backslash\\$centering or \\$\\backslash\\$begin\{center\} ... \\$\\backslash\\$end\{center\} are needed to
center the image above the caption.
* include 2 images side by side using "minipages"
-------------------------------------------------
\\$\\backslash\\$begin\{figure\}[htb]
\\$\\backslash\\$centering
\\$\\backslash\\$begin\{minipage\}[c]\{0.38\\$\\backslash\\$textwidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$includegraphics[width=\\$\\backslash\\$textwidth]\{img/tree\}
\\$\\backslash\\$end\{minipage\}
\\$\\backslash\\$begin\{minipage\}[c]\{0.58\\$\\backslash\\$textwidth\}
\\$\\backslash\\$includegraphics[width=\\$\\backslash\\$textwidth]\{img/leaf\}
\\$\\backslash\\$end\{minipage\}
\\$\\backslash\\$end\{figure\}
,,,
* put a caption at the side of an image 'tree.jpg'
--------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[pdftex]\{graphicx\}
\\$\\backslash\\$usepackage\{sidecap\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{SCfigure\}
\\$\\backslash\\$centering
\\$\\backslash\\$includegraphics[width=0.55\\$\\backslash\\$textwidth]\{image/tree.jpg\}
\\$\\backslash\\$caption\{ A tree \}
\\$\\backslash\\$end\{SCfigure\}
\\$\\backslash\\$end\{document\}
,,,
BOXES
@@ \url{http://latex.computersci.org/Reference/TextBoxes}
some thoughts on non-fancy boxes
@@ \url{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/fancybox/fancybox.pdf}
documentation for the fancybox package
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents different box commands
..
.. \\$\\backslash\\$fbox\{this\} - a box with a frame adjusted to the width of the text
.. \\$\\backslash\\$mbox\{some text\} - a box withh no frame adjusted to the text width
.. \\$\\backslash\\$makebox[3cm][l]\{text\} - like a frame box but without the frame
.. \\$\\backslash\\$framebox[3cm][l]\{like so\} - a box with a frame, 3cm wide, left aligned
.. \\$\\backslash\\$parbox[pos]\{width\}\{...\} - a box with lots of text (several lines)
..
* make an unframed box as wide as the page with text centered
>> \\$\\backslash\\$makebox[\\$\\backslash\\$textwidth]\{c e n t r a l\}
* an unframed box with text spread over the whole page width
>> \\$\\backslash\\$makebox[\\$\\backslash\\$textwidth][s]\{s p r e a d\}
* a framed box a little large than the text width
>> \\$\\backslash\\$framebox[1.1\\$\\backslash\\$width]\{Guess I’m framed now!\}
* create a centered table with a framed box around it
-----------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{table\}[h]
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$fbox\{\\%
\\$\\backslash\\$begin\{minipage\}\{.8\\$\\backslash\\$textwidth\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$begin\{tabular\}\{rl\}
foo \\& bar
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$caption\{A table of foo and bar.\}
\\$\\backslash\\$end\{minipage\}\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{table\}
\\$\\backslash\\$end\{document\}
,,,
\\#\\#( the table must go within a minipage within the "fbox" )
DASHED BOXES ....
* draw boxes with dashes
------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{dashbox\}
\\$\\backslash\\$begin\{document\}
\\% \\$\\backslash\\$dashbox\{dash\\_length\}(width,height)\{...\}
Before \\$\\backslash\\$dashbox\{Text in a Dashed box\} and after
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-dashbox.png \\%\\%
,,,
THE FANCYBOX PACKAGE ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents fancybox parameters
.. \\$\\backslash\\$fboxsep - the distance between the box and the frame
.. \\$\\backslash\\$shadowsize - the width of the shadow of a shadow box
.. \\$\\backslash\\$fboxrule - the width of the box frame line for shadowbox and doublebox
* create a box with a shadow
----------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$shadowbox\{\\$\\backslash\\$large\\$\\backslash\\$bf The Big Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.3 image/eg-fancybox-shadow.png \\%\\%
,,,
* create a box with a doubled border
------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$doublebox\{\\$\\backslash\\$large\\$\\backslash\\$bf The Big Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.3 image/eg-fancybox-double.png \\%\\%
,,,
* create a box with rounded corners
-----------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf The Big Tree\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.3 image/eg-fancybox-oval.png \\%\\%
,,,
ROUNDED CORNERS ....
The 'listings' package can also make frames with rounded corners
* create a round-corner box with 8 point distance between frame and content
--------------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf No Spacing\}
\\$\\backslash\\$setlength\\$\\backslash\\$fboxsep\{8pt\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf 8pt Box Spacing\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.4 image/eg-fancybox-fboxsep.png \\%\\%
,,,
* create a box with rounded corners with a thicker line
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf Normal Lines\}
\\$\\backslash\\$Ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf Thick Lines\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-fancybox-thicklines.png \\%\\%
,,,
* set the rounded corner radius for the box
-------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$parindent\}\{0pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$cornersize\{0.1\}
\\$\\backslash\\$Ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf Rounded 0.1\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$cornersize\{0.5\}
\\$\\backslash\\$Ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf Rounded 0.5\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$cornersize\{1\}
\\$\\backslash\\$Ovalbox\{\\$\\backslash\\$large\\$\\backslash\\$bf Rounded 1\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-fancybox-rounded.png \\%\\%
,,,
* the cornersize values are limited, the following values are possible
>> 0, 0.1, 0.5, 1
To make section heading have a rounded frame use the 'titlesec' package.
* display 2 oval boxes side by side
>> \\$\\backslash\\$ovalbox\{on the left\} \\$\\backslash\\$ovalbox\{on the right\}
* display 2 oval boxes underneath one another
>> \\$\\backslash\\$ovalbox\{above\} \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$ovalbox\{below\}
* put an oval box around a two column table of contents
-------------------------------------------------------
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage\{multicol\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{\\$\\backslash\\$linewidth\}
\\$\\backslash\\$begin\{multicols\}\{2\}
\\$\\backslash\\$tableofcontents
\\$\\backslash\\$end\{multicols\}
\\$\\backslash\\$end\{minipage\} \}
...
\\$\\backslash\\$end\{document\}
,,,
* display a shadow box
>> \\$\\backslash\\$shabox defined in the shadow package
COLOURED BOXES ....
* show a box with pale blue frame, pale green background
--------------------------------------------------------
\\$\\backslash\\$fboxrule6pt
\\$\\backslash\\$fcolorbox
\{blue!20\}\{green!30\}
\{Test \\$\\backslash\\$textcolor\{red!75\}\{Test\}\}
,,,
* display nested coloured boxes
-------------------------------
\\$\\backslash\\$fboxrule6pt
\\$\\backslash\\$fcolorbox
\{red!70!green\}\\% outer frame
\{yellow!30!blue\}\\% outer background
TestTestTest
\{\\$\\backslash\\$fcolorbox
\{-yellow!30!blue\}\\% inner frame
\{-red!70!green\}\\% inner background
\{Test\\$\\backslash\\$textcolor\{red!72.75\}\{Test\}\\$\\backslash\\$color\{-green\}Test\}\}
,,,
PAGE HEADINGS AND FOOTERS
@@ \url{http://texblog.wordpress.com/2007/11/07/headerfooter-in-latex-with-fancyhdr/}
some info about fancy headers.
* dont show any page headers or footers
>> \\$\\backslash\\$pagestyle\{empty\}
* show just the page number at the foot of the document, no header
>> \\$\\backslash\\$pagestyle\{plain\}
* show page number and section information etc
>> \\$\\backslash\\$pagestyle\{headings\}
* similar to "headings" but customizable
>> \\$\\backslash\\$pagestyle\{myheadings\}
* suppress all page header and footers for the current page only
>> \\$\\backslash\\$thispagestyle\{empty\}
* print the page and section name at the top of the page
--------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancyhdr\}
\\$\\backslash\\$pagestyle\{fancy\}
\\$\\backslash\\$fancyfoot\{\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$section\{Part One\}
Test fancy headings blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% =0.4 image/eg-fancyhdr-simple.png \\%\\%
,,,
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents fancy header format specifiers
.. E - Even page
.. O - Odd page
.. L - Left field
.. C - Center field
.. R - Right field
.. H - Header
.. F - Footer
..
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents special fancy header commands
.. \\$\\backslash\\$thepage - number of the current page
.. \\$\\backslash\\$leftmark - current chapter name eg "CHAPTER 3. SMALL CARS"
.. \\$\\backslash\\$rightmark - current section name "1.6. BIODIESEL"
.. \\$\\backslash\\$thesection - current section number
..
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some example fancy header commands
.. \\$\\backslash\\$renewcommand\{\\$\\backslash\\$headrulewidth\}\{0.4pt\} - set the head rule = 0.4
.. \\$\\backslash\\$renewcommand\{\\$\\backslash\\$footrulewidth\}\{1.4pt\} - set the foot rule = 0.4
..
* print the text '--draft--' in the center of the top of each page
------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancyhdr\}
\\$\\backslash\\$pagestyle\{fancy\}
\\$\\backslash\\$fancyhead[CO,CE]\{---Draft---\}
\\$\\backslash\\$fancyfoot\{\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$section\{Part One\}
Test fancy headings blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% =0.4 image/eg-fancyhdr-topcenter.png \\%\\%
,,,
* change the header with rhead, lhead etc, use todays date
----------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancyhdr\}
\\$\\backslash\\$pagestyle\{fancy\}
\\$\\backslash\\$fancyfoot\{\} \\% no footer
\\$\\backslash\\$fancyhead\{\}
\\$\\backslash\\$rhead\{\\$\\backslash\\$bfseries The Report (page \\$\\backslash\\$thepage)\}
\\$\\backslash\\$chead\{\\$\\backslash\\$today\}
\\$\\backslash\\$lhead\{To: Dean A. Smith\}
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$headrulewidth\}\{0.4pt\}
\\% use '\\$\\backslash\\$footrulewidth' for the foot rule
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$section\{Part One\}
Testing fancy headings blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-fancyhdr-lhead.png \\%\\%
,,,
* page number at left and right of header, text 'draft', thick rule
------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancyhdr\}
\\$\\backslash\\$pagestyle\{fancy\}
\\$\\backslash\\$fancyfoot\{\} \\% clear the default styles
\\$\\backslash\\$fancyhead\{\}
\\% this syntax is for 2 side documents
\\$\\backslash\\$fancyhead[CO,CE]\{Draft\}
\\$\\backslash\\$fancyhead[RO,LE] \{\\$\\backslash\\$thepage\}
\\$\\backslash\\$fancyhead[LO,RE] \{\\$\\backslash\\$thepage\}
\\$\\backslash\\$renewcommand\{\\$\\backslash\\$headrulewidth\}\{3pt\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$section\{Part One\}
Test fancy headings blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-fancyhdr-thickrule.png \\%\\%
,,,
FIGURES
FIGURE CAPTIONS ....
* change a figures caption to no label, bold italic font
>> \\$\\backslash\\$usepackage[labelformat=empty,labelsep=none,textfont=\{it,bf\}]\{caption\}
* make the figure captions italic
---------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]\{caption\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{figure\}[htb]
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$includegraphics[width=0.3\\$\\backslash\\$textwidth]\{image/tree.jpg\}
\\$\\backslash\\$caption\{Testing captions\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{figure\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-caption-italic.png \\%\\%
,,,
* change the automatically generated caption name in figures to "Fig."
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$figurename\}\{Fig.\}
* reduce the amount of white space between an image and its caption
-------------------------------------------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{figure\}[htb]
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$includegraphics[width=0.3\\$\\backslash\\$textwidth]\{image/tree.jpg\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$caption\{a big gap\}
\\$\\backslash\\$end\{figure\}
\\$\\backslash\\$begin\{figure\}[htb]
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$includegraphics[width=0.3\\$\\backslash\\$textwidth]\{image/tree.jpg\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$vspace\{-20pt\} \\% the negative value reduces vertical space
\\$\\backslash\\$caption\{a smaller gap\}
\\$\\backslash\\$end\{figure\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-caption-gap.png \\%\\%
,,,
CONVERTING OTHER FORMATS TO LATEX
---------------------------------------------------------------
CONVERTING SOURCE CODE TO LATEX ....
Tools:
highlight, \url{http://www.andre-simon.de/}
source-highlight,
* convert a java file to latex.
>> highlight -L -i Test.java -o Test.java.tex
TABLES
@@ \url{http://www.tug.org/pracjourn/2007-1/mori/mori.pdf}
a tutorial about how to make professional tables
@@ \url{http://en.wikibooks.org/wiki/LaTeX/Tables}
a reasonable wikibook about this topic.
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents table specific latex packages
.. longtable - allows table to span more than 1 page, and provides headings
.. booktab - provides heavier top and bottom horizontal rules
.. colortbl - allows background colours for tables
.. xcolor - alternate row colours for tables
.. array - expands column alignment possibilities
..
GOTCHAS ....
If the number of columns in the body is greater than
the number of columns in the header then the document
will not compile with pdflatex.
too many columns in a table causes a compile error
but too few columns doesnt seem to matter
* dont put anything between the last row and \\$\\backslash\\$end\{tabular\}
>> \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$bottomrule \\$\\backslash\\$end\{tabularx\} \\#\\#(wont work)
SIMPLE TABLES ....
* to get alternate coloured rows in a table see the "xcolor" package
* a boxed 2 column table with 1st column left aligned, 2nd center
-------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ |l|c| \}
\\$\\backslash\\$hline
6 \\& spain \\$\\backslash\\$\\$\\backslash\\$
4 \\& euskera \\$\\backslash\\$\\$\\backslash\\$
7 \\& catala \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* a simple table with vertical lines
------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\% columns aligned: left, center, right
\\$\\backslash\\$begin\{tabular\}\{ |l|c||r| \}
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$
4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-table-simple.png \\%\\%
,,,
If you want a table column to contain a lot of text then
the 'p\{..\}' specifier is necessary in order to make the
text wrap to that width.
* a table with a 5cm wide paragraph column with bold left column labels
-----------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$begin\{tabular\}\{ l|p\{5cm\}| \}
\\$\\backslash\\$textbf\{\\$\\backslash\\$textit\{ pandoc \}\} \\&
Pandoc is a system using the 'markdown' syntax which
can transform documents into various output formats
\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$textbf\{\\$\\backslash\\$textit\{ halibut \}\} \\&
Halibut is another 'plain-text' documentation system.
\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{document\}
,,,
* a table 1/2 the page width, small capitals 1st col, small text in 2nd
------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\% the text in the 'X' column will wrap and be small
\\% the '>\{\\$\\backslash\\$small\}' syntax comes from the 'array' package
\\$\\backslash\\$begin\{tabularx\}\{0.5\\$\\backslash\\$textwidth\}\{ >\{\\$\\backslash\\$scshape\}l | >\{\\$\\backslash\\$small\}X \}
Sastra \\& An indonesian word of hindu origin
which means culture or literature. \\$\\backslash\\$\\$\\backslash\\$
Greja \\& A word of portuguese origin meaning
church. \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
* a table 1/2 page width, in a 'glossary' style
-----------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\% the text in the 'X' column will wrap and be small
\\$\\backslash\\$begin\{tabularx\}\{0.5\\$\\backslash\\$textwidth\}\{ >\{\\$\\backslash\\$scshape\}r | >\{\\$\\backslash\\$itshape\}X \}
Unix \\& An operating system created in the seventies
in Bell Labs and North American Universities. \\$\\backslash\\$\\$\\backslash\\$
Linux \\& A popular free clone of the unix operating system
created by volunteers \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
* a glossary style table, 2nd column 6/10ths of the page width
-----------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ >\{\\$\\backslash\\$scshape\}r | >\{\\$\\backslash\\$itshape\}p\{0.6\\$\\backslash\\$linewidth\} \}
Unix \\& An operating system created in the seventies
in Bell Labs and North American Universities. \\$\\backslash\\$\\$\\backslash\\$
Linux \\& A popular free clone of the unix operating system
created by volunteers \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* a table with a column taking up 1/3 of the page width
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$begin\{tabular\}\{ l|p\{0.33\\$\\backslash\\$textwidth\}| \}
\\$\\backslash\\$textsc\{ pandoc \} \\&
Pandoc is a system using the 'markdown' syntax which
can transform documents into various output formats \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$textsc\{ halibut \} \\&
Halibut is another 'plain-text' documentation system. \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{document\}
,,,
* a simple table with horizontal and vertical lines
---------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ l|c|r| \}
\\$\\backslash\\$hline
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$
4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% = 0.2 image/eg-table-lines.png \\%\\%
,,,
TABLE FRAMES ....
* put an box with rounded corners around a table
------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{fancybox\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{\\$\\backslash\\$linewidth\}
\\$\\backslash\\$begin\{tabular\}\{ l|c \}
6 \\& spain \\$\\backslash\\$\\$\\backslash\\$
4 \\& euskera \\$\\backslash\\$\\$\\backslash\\$
7 \\& catala \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{document\}
,,,
* put an rounded-corners box around an alternating row colour table
-------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{fancybox, tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{0.75\\$\\backslash\\$textwidth\}
\\%\\% 1st column bold, 2nd column italic
\\$\\backslash\\$begin\{tabularx\}\{\\$\\backslash\\$textwidth\}\{>\{\\$\\backslash\\$bfseries\}l >\{\\$\\backslash\\$itshape\}X \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{document\}
,,,
* alternate row colours and a rounded frame without 'tabularx'
-------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{fancybox, array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{0.75\\$\\backslash\\$textwidth\}
\\$\\backslash\\$begin\{tabular\}\{>\{\\$\\backslash\\$bfseries\}l >\{\\$\\backslash\\$itshape\}l \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{document\}
,,,
* put an rounded-corners box around a table, the box wider than the table
--------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{fancybox, tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{\\$\\backslash\\$textwidth\}
\\$\\backslash\\$begin\{tabularx\}\{.75\\$\\backslash\\$textwidth\}\{>\{\\$\\backslash\\$bfseries\}l >\{\\$\\backslash\\$itshape\}X \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{document\}
,,,
* a double nested box around a table
------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{fancybox, array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{0.75\\$\\backslash\\$textwidth\}
\\$\\backslash\\$ovalbox\{\\$\\backslash\\$begin\{minipage\}\{0.97\\$\\backslash\\$textwidth\}
\\$\\backslash\\$begin\{tabular\}\{>\{\\$\\backslash\\$bfseries\}r >\{\\$\\backslash\\$itshape\}l \}
look \\& look up words \\$\\backslash\\$\\$\\backslash\\$ cut \\& cut up fields \\$\\backslash\\$\\$\\backslash\\$
rs \\& change arrays \\$\\backslash\\$\\$\\backslash\\$ jot \\& make data \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{minipage\} \}
\\$\\backslash\\$end\{document\}
,,,
PARTIAL LINES AND MULTIPLE COLUMNS ....
* make a partial horizontal line beginning in column 2 and ending col 3
>> \\$\\backslash\\$cline\{2-3\}
* a table with a partial horizontal line under "octal"
------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|r|l|\}
\\$\\backslash\\$hline 7C0 \\& hexadecimal \\$\\backslash\\$\\$\\backslash\\$
3700 \\& octal \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$cline\{2-2\}
11111000000 \\& binary \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline \\$\\backslash\\$hline 1984 \\& decimal \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% = 0.35 image/eg-table-partial-line.png \\%\\%
,,,
THE HEADER ROW ....
Most tables contain a row (usually at the top of the table)
which explains the meaning of the column content.
* a boxed 2 column table with bold 'header' row
-----------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ r l \}
\\$\\backslash\\$textbf\{Language\} \\& \\$\\backslash\\$textbf\{Country\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
espanol \\& Spain \\$\\backslash\\$\\$\\backslash\\$
euskera \\& Basque \\$\\backslash\\$\\$\\backslash\\$
warlpiri \\& Australia \\$\\backslash\\$\\$\\backslash\\$
pintupi \\& Australia \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* create a center-aligned heading which spans 2 columns
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|r|l|\}
\\$\\backslash\\$hline
\\$\\backslash\\$multicolumn\{2\}\{|c|\}\{Some Tools\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
feh \\& A small image display utility \\$\\backslash\\$\\$\\backslash\\$
gnuplot \\& A program to create graphs and charts \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* create a center-aligned large italic heading spanning 2 columns
-----------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{r|l\}
\\$\\backslash\\$multicolumn\{2\}\{c\}\{
\\$\\backslash\\$Large\\$\\backslash\\$itshape Some Tools\} \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$textbf\{tool\} \\& \\$\\backslash\\$textbf\{usage\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
feh \\& A small image display utility \\$\\backslash\\$\\$\\backslash\\$
gnuplot \\& A program to create graphs and charts \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
In the recipe above we use the '\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$\\$\\backslash\\$' to create an empty row which gives
more space below the heading. This is all probably better done using a
caption to a figure.
* rotate the headings in a table
--------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ll\}
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Name\} \\$\\backslash\\$end\{turn\} \\&
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Surname\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
cell 1 \\& cell 2 \\$\\backslash\\$\\$\\backslash\\$
cell 3 \\& cell 4 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* another style of rotated headings in a table
--------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{l|ll\}
\\$\\backslash\\$begin\{turn\}\{0\} \\$\\backslash\\$textbf\{Folder Name\} \\$\\backslash\\$end\{turn\} \\&
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Total Size\} \\$\\backslash\\$end\{turn\} \\&
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Last Modified\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
/dev \\& 200M \\& 4 april \\$\\backslash\\$\\$\\backslash\\$
/usr \\& 20G \\& 5 april \\$\\backslash\\$\\$\\backslash\\$
/bin \\& 10G \\& 1 april \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
COLUMN SEPARATOR ....
* a table with a dot "." as the column separator
--------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{r@\{.\}l\}
3 \\& 14159 \\$\\backslash\\$\\$\\backslash\\$
16 \\& 2 \\$\\backslash\\$\\$\\backslash\\$
123 \\& 456 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* use @\{\} to suppress the space before or after the text in a column.
---------------------------------------------------------------------
\\$\\backslash\\$begin\{tabular\}\{|@\{\}l|l|\}
\\$\\backslash\\$hline
stuff \\& stuff \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline stuff \\& stuff \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
,,,
BASH AND LATEX TABLES
It is possible to use bash and awk to generate latex
tables for printing.
* a bash function to convert a du listing to pdf
------------------------------------------------
function test \{
cat << xxx | pdflatex
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ll\}
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Total Size\} \\$\\backslash\\$end\{turn\} \\&
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{File Name\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$(du -sh * | tr -d '\\_\\$' | awk '\{print \\$1" \\& "\\$2" \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$"\}')
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
xxx
\}
test; evince texput.pdf
,,,
In the above function latex special characters such as '\\$' and '\\_' must
be translated or escaped somehow. Also if the listing is longer than a
page then it needs to use the 'longtable' package.
AWK AND TABLES ....
It seems that from the bash shell we could write some interesting awk
scripts to turn text data into latex tables. using xcolor for alternate
row colours, tabularx for column widths, array for column formatting, etc
* maybe something like this, but with good syntax
-------------------------------------------------
BEGIN \{ print '\\$\\backslash\\$documentclass' etc etc \}
\{for i to \\$NR \{ print '\\&' \} print \\$\\backslash\\$\\$\\backslash\\$ \}
END \{ print '\\$\\backslash\\$end\{document\}' \}
,,,
CODE LISTINGS IN TABLES ....
* put a verbatim in a table cell
--------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ |p\{5cm\}|c|\}
\\$\\backslash\\$hline
\\$\\backslash\\$begin\{verbatim\}
for code to protocol
\\$\\backslash\\$end\{verbatim\}
\\& description
\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* put a code listing in a table cell
------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$lstset\{basicstyle=\\$\\backslash\\$ttfamily, breaklines=true, numbers=left\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ |p\{9cm\}|p\{3cm\}|\}
\\$\\backslash\\$hline
\\$\\backslash\\$begin\{lstlisting\}
for i = 1 to 20
do
print why is this so;
end
\\$\\backslash\\$end\{lstlisting\}
\\& a code sample
\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
TEXT ALIGNMENT ....
* center text vertically within a table cell
--------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|m\{1in\}|m\{1in\}|\}
\\$\\backslash\\$hline cell 1 \\& cell 2 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline cell 3 \\& cell 4 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* make text in one column italic with the 'arrays' package
--------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|l|>\{\\$\\backslash\\$itshape\}l|\}
\\$\\backslash\\$hline one \\& cell 2 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline cell 3 \\& cell 4 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline cell 5 \\& cell 6 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
TABLE COLUMNS ....
* make the first column of a table automatically bold
-----------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{ >\{\\$\\backslash\\$bfseries\}l | p\{6cm\}\}
zenity \\& A tool to create dialog windows \\$\\backslash\\$\\$\\backslash\\$
kdialog \\& The equivalent tool for the kde desktop \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end \{tabular\}
\\$\\backslash\\$end\{document\}
,,,
By default, the text in latex tables does not 'wrap'.
To make it wrap you must you the 'p' specifier or the
'array' package.
* place 2 hyphens before and after every row in the 1st column
--------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\%\\% \\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Total Size\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$begin\{tabular\}\{ >\{--\} l <\{--\} | p\{6cm\}\}
zenity \\& A tool to create dialog windows \\$\\backslash\\$\\$\\backslash\\$
kdialog \\& The equivalent tool for the kde desktop \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end \{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* attempting to rotate every element of a column
>> \{>\{\\$\}c<\{\\$\}\}. but this is not working
-----------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{array\}
\\$\\backslash\\$begin\{document\}
\\%\\% \\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Total Size\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$begin\{tabular\}\{ >\{\\$\\backslash\\$begin\{turn\}\{80\}\} p\{6cm\} <\{\\$\\backslash\\$end\{turn\}\} | p\{6cm\}\}
zenity \\& A tool to create dialog windows \\$\\backslash\\$\\$\\backslash\\$
kdialog \\& The equivalent tool for the kde desktop \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end \{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* a table with a paragraph column with a width of 5cm
-------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$begin\{tabular\}\{ l|p\{5cm\}|\}
Monday \\&
A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\$\\backslash\\$\\$\\backslash\\$
Tuesday \\&
Cloudy with rain, across many northern
regions. Clear spells across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{document\}
,,,
* a table with a column which spans multiple rows
-------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{multirow\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|l|l|l|\}
\\$\\backslash\\$hline
\\$\\backslash\\$multicolumn\{3\}\{|c|\}\{Team sheet\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
Goalkeeper \\& GK \\& Paul Robinson \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$\\backslash\\$multirow\{4\}\{*\}\{Defenders\} \\& LB \\& Lucus Radebe \\$\\backslash\\$\\$\\backslash\\$
\\& DC \\& Michael Duberry \\$\\backslash\\$\\$\\backslash\\$
\\& DC \\& Dominic Matteo \\$\\backslash\\$\\$\\backslash\\$
\\& RB \\& Didier Domi \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
TABLE WIDTH ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents packages for changing table width
.. tabularx - changes column width
.. tabular* - change spaces between columns
..
* create a table 1/2 the page text width, with the 2nd column wrapping
----------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabularx\}\{0.5\\$\\backslash\\$textwidth\}\{ l|X \}
\\$\\backslash\\$hline
Vim \\& A text editor based apon the 'vi' and 'ed'
unix text editors. \\$\\backslash\\$\\$\\backslash\\$
Sam \\& A text editor favoured by some veteran
unix coders \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
* make a 250pt wide table with 4 columns (2 resizable columns)
>> \\$\\backslash\\$begin\{tabularx\}\{250pt\}\{|c|X|c|X|\}
* a table 1/2 the width of the page, with italic text in 2nd column
------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\% the '>\{\\$\\backslash\\$italic\}' syntax comes from the 'array' package
\\$\\backslash\\$begin\{tabularx\}\{0.5\\$\\backslash\\$textwidth\}\{ l | >\{\\$\\backslash\\$itshape\}X \}
Force \\& Force is a vector quantity. \\$\\backslash\\$\\$\\backslash\\$
Moment \\& is defined as the cross product of the position vector \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
* make a column with small capital text which will wrap
>> >\{\\$\\backslash\\$scshape\\$\\backslash\\$small\}X
* Tabularx can have, rowcolours, multiple column rows, footnotes
* make a alternate pale brown row-colours, 2/3rds the page width
----------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\%\\% 1st column bold
\\$\\backslash\\$begin\{tabularx\}\{.75\\$\\backslash\\$textwidth\}\{>\{\\$\\backslash\\$bfseries\} lX \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
In the above table, column-width (not inter-column-spacing) will be
adjusted to ensure the correct table width
* resize a table to be 8cm wide preserving the original size ratio,,
--------------------------------------------------------------------
\\$\\backslash\\$resizebox\{8cm\}\{!\} \{
\\$\\backslash\\$begin\{tabular\}...
\\$\\backslash\\$end\{tabular\}
\}
,,,
* scale a table to be one half its original size
------------------------------------------------
\\$\\backslash\\$scalebox\{0.5\}\{
\\$\\backslash\\$begin\{tabular\}...
\\$\\backslash\\$end\{tabular\}
\}
,,,
* change the space between columns
>> \\$\\backslash\\$setlength\{\\$\\backslash\\$tabcolsep\}\{5pt\}
* make a table take up all the page width using 'geometry'
----------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$usepackage[margin=1cm,noheadfoot]\{geometry\}
\\$\\backslash\\$begin\{document\}
\\%\\% 3rd column italic
\\$\\backslash\\$begin\{tabularx\}\{\\$\\backslash\\$linewidth\}\{l|l >\{\\$\\backslash\\$itshape\}X\}
\{\\$\\backslash\\$bfseries\\$\\backslash\\$large Identifier\} \\&
\{\\$\\backslash\\$bfseries\\$\\backslash\\$large type\} \\&
\{\\$\\backslash\\$bfseries\\$\\backslash\\$large What is this used for?\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
tracing \\& boolean \\& Determines whether debugging messages on/off \\$\\backslash\\$\\$\\backslash\\$
isOn \\& boolean \\& whether the tv is on or off (in standby mode) \\$\\backslash\\$\\$\\backslash\\$
onBefore \\& boolean \\& Whether the tv has been turned on before \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
IMAGES IN TABLES ....
* place an image in a table
---------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{graphicx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|c|c|\}
first image \\& \\$\\backslash\\$includegraphics[scale=0.3]\{image/tree.jpg\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$newline
second image \\& \\$\\backslash\\$includegraphics[scale=0.3]\{image/tree.jpg\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* place a code listing and an image in a table
----------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings, graphicx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{|p\{5cm\}|c|\}
\\$\\backslash\\$hline
\\$\\backslash\\$begin\{lstlisting\}[breaklines=true]
for i = 1 to 20
do
print why is this so;
end
\\$\\backslash\\$end\{lstlisting\}
\\& \\$\\backslash\\$includegraphics[scale=0.3]\{image/tree.jpg\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
more text \\& \\$\\backslash\\$includegraphics[scale=0.3]\{image/tree.jpg\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
ROTATING TABLES ....
* create a sideways table
-------------------------
pre:
\\$\\backslash\\$usepackage\{rotating\}
body:
\\$\\backslash\\$begin\{sidewaystable\}
\\$\\backslash\\$begin\{tabular\}...
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{sidewaystable\}
,,,
* place a sideways table exactly in its current position
--------------------------------------------------------
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$usepackage\{rotfloat\}
\\$\\backslash\\$begin\{sidewaystable\}[H]
\\$\\backslash\\$begin\{tabular\}...
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{sidewaystable\}
,,,
* place a caption above the table
---------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{table\}[h]
\\$\\backslash\\$centering
\\$\\backslash\\$caption\{Alphabetic values\}
\\$\\backslash\\$begin\{tabular\}\{|r|c|\}
a \\& b \\$\\backslash\\$\\$\\backslash\\$ c \\& d \\$\\backslash\\$\\$\\backslash\\$
e \\& f \\$\\backslash\\$\\$\\backslash\\$ g \\& h \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{table\}
\\$\\backslash\\$end\{document\}
,,,
* create a table which can be referenced with '\\$\\backslash\\$ref\{table1\}'
------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{table\}
\\$\\backslash\\$centering
\\$\\backslash\\$begin\{tabular\}\{ll\}
a \\& b \\$\\backslash\\$\\$\\backslash\\$ c \\& d \\$\\backslash\\$\\$\\backslash\\$ e \\& f \\$\\backslash\\$\\$\\backslash\\$ g \\& h \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$caption\{An example of a referenceable table\}
\\$\\backslash\\$label\{table1\}
\\$\\backslash\\$end\{table\}
See the table \\$\\backslash\\$ref\{table1\}
\\$\\backslash\\$end\{document\}
\\% run pdflatex at least twice to resolve the references
,,,
* use parbox to centre an image in a table cell
>> \\$\\backslash\\$parbox[c]\{1em\}\{\\$\\backslash\\$includegraphics\{image.png\}\}
* change the table name in captions to "Tab."
>> \\$\\backslash\\$renewcommand\{\\$\\backslash\\$tablename\}\{Tab.\}
* place 2 tables side by side
-----------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{table\}[ht]
\\$\\backslash\\$begin\{minipage\}[b]\{0.5\\$\\backslash\\$linewidth\}\\$\\backslash\\$centering
\\$\\backslash\\$begin\{tabular\}\{|c|c|c|\}
\\$\\backslash\\$hline
1\\&1\\&1\\$\\backslash\\$\\$\\backslash\\$ 2\\&2\\&2\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{minipage\}
\\$\\backslash\\$hspace\{0.5cm\}
\\$\\backslash\\$begin\{minipage\}[b]\{0.5\\$\\backslash\\$linewidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$begin\{tabular\}\{|c|c|c|\}
\\$\\backslash\\$hline
1\\&1\\&1\\$\\backslash\\$\\$\\backslash\\$ 2\\&2\\&2\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\} \\$\\backslash\\$end\{minipage\}
\\$\\backslash\\$end\{table\}
\\$\\backslash\\$end\{document\}
,,,
* place tables or images side by side using "subfigure"
>> \\$\\backslash\\$usepackage\{subfigure\}
* place footnotes at the bottom of a table
>> use "minipage" environment
COLOURS IN TABLES ....
ROW COLOURS ....
* make a alternate pale brown row-colours, 2/3rds the page width
----------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[]\{1\}\{brown!20\}\{\}
\\%\\% 1st column bold, 2nd column italic
\\$\\backslash\\$begin\{tabularx\}\{.75\\$\\backslash\\$textwidth\}\{>\{\\$\\backslash\\$bfseries\}l >\{\\$\\backslash\\$itshape\}X \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
The following recipe is a nice looking scheme for displaying
date which takes up only one line.
* alternating pale brown row-colours, with a brownish row lines
--------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$arrayrulecolor\{brown!70\}
\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{1\}\{brown!20\}\{\}
\\%\\% 1st column bold, 2nd column italic
\\$\\backslash\\$begin\{tabularx\}\{.75\\$\\backslash\\$textwidth\}\{>\{\\$\\backslash\\$bfseries\}l >\{\\$\\backslash\\$itshape\}X \}
Perl \\& A scripting language popular in the late 90s \\$\\backslash\\$\\$\\backslash\\$
Java \\& A clumsy inefficient virtual machine language \\$\\backslash\\$\\$\\backslash\\$
Python \\& An increasingly trendy language \\$\\backslash\\$\\$\\backslash\\$
Sed \\& A turing complete text editing language \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{document\}
,,,
* create a gaudy table with alternating row colours
---------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{center\}
\\$\\backslash\\$rowcolors\{1\}\{green\}\{pink\}
\\$\\backslash\\$begin\{tabular\}\{ll\}
grep \\& find text \\$\\backslash\\$\\$\\backslash\\$
find \\& find files \\$\\backslash\\$\\$\\backslash\\$
locate \\& find files faster \\$\\backslash\\$\\$\\backslash\\$
du \\& find how big the files are \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{center\}
\\$\\backslash\\$end\{document\}
,,,
Use the \\$\\backslash\\$hiderowcolors and \\$\\backslash\\$showrowcolors commands to turn on and off the
colours)
'\\$\\backslash\\$usepackage[table]\{xcolor\}' command depends on the colortbl and xcolor
packages for colouring alternate rows of a table.
* horizontal row-lines, pale blue \\& gray. start colours at line 2
>> \\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{2\}\{blue!15\}\{gray!15\}
this command goes before the table command
* alternate transparent blue and white, starting at row 4
>> \\$\\backslash\\$rowcolors\{4\}\{blue!10\}\{\}
* make alternate green and yellow table lines, with horizontal lines
* start colouring at the third line
-----------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{3\}\{green!25\}\{yellow!50\}
\\$\\backslash\\$arrayrulecolor\{red!75!gray\} \\% colour for the table rules
\\$\\backslash\\$begin\{tabular\}\{ lcr \} \\% alignment left, centre, right
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$
4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-tablerows.png \\%\\%
,,,
* make alternate lines green (and white)
----------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors\{1\}\{green!25\}\{\}
\\$\\backslash\\$begin\{tabular\}\{ lll \}
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$ 4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$ 7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-alternaterowsgreen.png \\%\\%
,,,
* a bluey grey colour
>> red!75!green!50!blue!25
* make very pale alternate blue table rows with row numbers
-----------------------------------------------------------
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors\{1\}\{blue!15\}\{\}
\\$\\backslash\\$begin\{tabular\}\{ lll \}
\\$\\backslash\\$number\\$\\backslash\\$rownum \\& cd \\& return to the home folder \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$number\\$\\backslash\\$rownum \\& cd - \\& return to the previous folder \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$number\\$\\backslash\\$rownum \\& select \\& make a selection \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
,,,
* display a table which changes horizontal line colour halfway through
----------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{1\}\{gray!25\}\{\}
\\$\\backslash\\$arrayrulecolor\{red!100\}
\\$\\backslash\\$begin\{tabular\}\{ ll \}
italy \\& 2 \\$\\backslash\\$\\$\\backslash\\$ spain \\& 5 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$arrayrulecolor\{black\}
england \\& 7 \\$\\backslash\\$\\$\\backslash\\$ france \\& 10 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-arrayrulecolor.png \\%\\%
,,,
* a table with the 3rd row pale green, horizontal black lines
-------------------------------------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{1\}\{\}\{\}
\\$\\backslash\\$arrayrulecolor\{blue\}
\\$\\backslash\\$begin\{tabular\}\{ ll \}
italy \\& 2 \\$\\backslash\\$\\$\\backslash\\$ spain \\& 5 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$rowcolor\{green!20\}
england \\& 7 \\$\\backslash\\$\\$\\backslash\\$ france \\& 10 \\$\\backslash\\$\\$\\backslash\\$
germany \\& 7 \\$\\backslash\\$\\$\\backslash\\$ turkey \\& 11 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-rowcolors-1.png \\%\\%
,,,
* table with alternating pale blue lines, with a dark blue frame
----------------------------------------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors\{1\}\{blue!10\}\{\}
\\$\\backslash\\$arrayrulecolor\{blue!75\}
\\$\\backslash\\$begin\{tabular\}\{ | ll | \}
\\$\\backslash\\$hline
italy \\& 2 \\$\\backslash\\$\\$\\backslash\\$ spain \\& 5 \\$\\backslash\\$\\$\\backslash\\$
england \\& 7 \\$\\backslash\\$\\$\\backslash\\$ france \\& 10 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-xcolor-tableframe.png \\%\\%
,,,
* display a table aligned to the right, with text flowing around it
-------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{wrapfig\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{1\}\{blue!20\}\{\}
\\% '0.5\\$\\backslash\\$textwidth' the wrapped area takes up half the page width
\\$\\backslash\\$begin\{wraptable\}\{r\}\{0.5\\$\\backslash\\$textwidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$caption\{Country Numbers\}
\\$\\backslash\\$begin\{tabular\}\{ | ll | \}
italy \\& 2 \\$\\backslash\\$\\$\\backslash\\$ spain \\& 5 \\$\\backslash\\$\\$\\backslash\\$
england \\& 7 \\$\\backslash\\$\\$\\backslash\\$ france \\& 10 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{wraptable\}
blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% =0.3 image/eg-xcolor-wrappedtable.png \\%\\%
,,,
* display a table aligned to the right, wrapped using tabularx
--------------------------------------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage\{wrapfig\}
\\$\\backslash\\$usepackage\{tabularx\}
\\$\\backslash\\$usepackage[table]\{xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{wraptable\}\{r\}\{0.5\\$\\backslash\\$textwidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$rowcolors\{1\}\{blue!10\}\{\}
\\$\\backslash\\$arrayrulecolor\{blue\}
\\%
\\% "\\$\\backslash\\$rowcolors[\\$\\backslash\\$hline]\{1\}\{blue!20\}\{\}" gives lines between rows
\\% "\\$\\backslash\\$rowcolors\{2\}\{blue!20\}\{\}" starts colouring at row 2
\\% "\\$\\backslash\\$rowcolors\{2\}\{blue!20\}\{gray!20\}" alternates pale blue/gray rows
\\%
\\% '>\{\\$\\backslash\\$tiny\}' makes the second column very small text
\\%
\\$\\backslash\\$begin\{tabularx\}\{0.4\\$\\backslash\\$textwidth\}\{ |l>\{\\$\\backslash\\$tiny\}X| \}
\\$\\backslash\\$hline
italy \\& a country known for its pomodoro and rabiata \\$\\backslash\\$\\$\\backslash\\$
spain \\& tortilla espanola and some snail eating in catalonia \\$\\backslash\\$\\$\\backslash\\$
england \\& not much mor than fish and chips \\$\\backslash\\$\\$\\backslash\\$
france \\& various delicacies \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabularx\}
\\$\\backslash\\$end\{wraptable\}
blah...blah
\\$\\backslash\\$end\{document\}
\\%\\% =0.4 image/eg-xcolor-tabularx-frame.png \\%\\%
,,,
* base colour names
-------------------
black darkgray lime pink violet
blue gray magenta purple white
brown green olive red yellow
cyan lightgray orange teal
,,,
COLOUR SERIES ROW COLOURS ....
>> \\$\\backslash\\$definecolorseries\{test\}\{hsb\}\{step\}[hsb]\{.575,1,1\}\{.11,-.05,0\}
------------------
rowcolors[\\$\\backslash\\$hline]\{1\}\{test!!+\}\{test!!+\}
\\$\\backslash\\$begin\{tabular\}\{c\}
\\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$number\\$\\backslash\\$rownum\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$end\{tabular\}
,,,
GOTCHAS ....
* grey is spelled 'gray' not 'grey'
>> \\$\\backslash\\$rowcolours\{1\}\{grey!25\} \\#\\#(No! this is incorrect)
>> \\$\\backslash\\$rowcolours\{1\}\{gray!25\} \\#\\#(Correct)
* you have to have a row start number
>> \\$\\backslash\\$rowcolors\{\}\{gray!25\}\{\} \\#\\#(No! incorrect)
>> \\$\\backslash\\$rowcolors\{1\}\{gray!25\}\{\} \\#\\#(correct)
LONG TABLES ....
The long table package allows tables to span more than one
page, which is good and necessary.
* a bash function to create a table which spans more than one page
------------------------------------------------------------------
function test \{
cat << xxx | pdflatex
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{longtable\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{longtable\}\{ll\}
\\$\\backslash\\$textit\{Total Size\} \\& \\$\\backslash\\$textit\{File Name\} \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$(du -sh * | tr -d '\\_\\$' | awk '\{print \\$1" \\& "\\$2" \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$"\}')
\\$\\backslash\\$hline
\\$\\backslash\\$end\{longtable\}
\\$\\backslash\\$end\{document\}
xxx
\}
test; test; evince texput.pdf
,,,
The pdflatex tool may need to be run more than once on the input inorder
to properly calculate and display the column widths
* a long table with rotated headers (as a bash function)
--------------------------------------------------------
function test \{
cat << xxx | pdflatex
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{rotating\}
\\$\\backslash\\$usepackage\{longtable\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{longtable\}\{ll\}
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{Total Size\} \\$\\backslash\\$end\{turn\} \\&
\\$\\backslash\\$begin\{turn\}\{80\} \\$\\backslash\\$textit\{File Name\} \\$\\backslash\\$end\{turn\}
\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$hline
\\$(du -sh * | tr -d '\\_\\$' | awk '\{print \\$1" \\& "\\$2" \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$"\}')
\\$\\backslash\\$hline
\\$\\backslash\\$end\{longtable\}
\\$\\backslash\\$end\{document\}
xxx
\}
test; test; evince texput.pdf
,,,
* number non-empty line of a file and display each as a table row
-----------------------------------------------------------------
function test \{
cat << xxx | pdflatex
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[margin=2cm,noheadfoot]\{geometry\}
\\$\\backslash\\$usepackage\{longtable\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{longtable\}\{ll\}
\\$\\backslash\\$textit\{No.\} \\& \\$\\backslash\\$textit\{Phrase\} \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$(nl -bp[a-z] \\$1 | tr -d '\\_\\$' | sed 's/\\^\\$\\backslash\\$s*//;s/\\$\\backslash\\$s\\$\\backslash\\$+/ \\$\\backslash\\$\\& \\$\\backslash\\$\\$\\backslash\\$Large \texttt{/;s/\\$/} \\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$\\$\\backslash\\$/')
\\$\\backslash\\$hline
\\$\\backslash\\$end\{longtable\}
\\$\\backslash\\$end\{document\}
xxx
\}
test test.txt; test test.txt; evince texput.pdf
,,,
* make a long table
-------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{longtable,booktabs\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{longtable\}\{lrr\}
\\$\\backslash\\$caption[A Caption]\{A Caption\}\\$\\backslash\\$label\{lab\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
Heading 1 \\& Heading 2 \\& Heading 3 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$endfirsthead
\\%\\$\\backslash\\$caption[]\{(continued)\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
Head 1 \\& Head 2 \\& Head 3 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$endhead
\\$\\backslash\\$toprule
\\$\\backslash\\$endfoot
\\%\\% Put the rows of your table here
\\$\\backslash\\$end\{longtable\}
\\$\\backslash\\$end\{document\}
,,,
WRAPPING TEXT AROUND TABLES ....
@@ \url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=textflow}
a discussion of the different packages for wrapping text
around things
* wrap text around a table, centering the table above a caption
---------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{wrapfig\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{wraptable\}\{r\}\{0.5\\$\\backslash\\$textwidth\}
\\$\\backslash\\$centering
\\$\\backslash\\$begin\{tabular\}\{ |l|c|r| \}
\\$\\backslash\\$hline
1 \\& 2 \\& 3 \\$\\backslash\\$\\$\\backslash\\$
4 \\& 5 \\& 6 \\$\\backslash\\$\\$\\backslash\\$
7 \\& 8 \\& 9 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$hline
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$caption\{A table wrapped in text\}
\\$\\backslash\\$end\{wraptable\}
\\$\\backslash\\$small text blah.blah
\\$\\backslash\\$end\{document\}
\\%\\% =0.3 image/eg-wrapfig-table.png \\%\\%
,,,
USING THE BOOKTABS PACKAGE FOR TABLES ....
@@ \url{http://tug.ctan.org/macros/latex/contrib/booktabs/booktabs.pdf}
Documentation for the "booktabs" package, which provides
heavier top and bottom rules for tables and better spacing under
the rules.
* create a table which uses heavier top and bottom rules and better spacing
-------------------------------------------------------------------------,
\\$\\backslash\\$documentclass[a4paper,12pt]\{article\}
\\$\\backslash\\$usepackage\{booktabs\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{tabular\}\{llr\}
\\$\\backslash\\$toprule
\\$\\backslash\\$multicolumn\{2\}\{c\}\{Item\} \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$cmidrule(r)\{1-2\}
Animal \\& Description \\& Price (\\$\\backslash\\$\\$) \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$midrule
Gnat \\& per gram \\& 13.65 \\$\\backslash\\$\\$\\backslash\\$
\\& each \\& 0.01 \\$\\backslash\\$\\$\\backslash\\$
Gnu \\& stuffed \\& 92.50 \\$\\backslash\\$\\$\\backslash\\$
Armadillo \\& frozen \\& 8.99 \\$\\backslash\\$\\$\\backslash\\$
\\$\\backslash\\$bottomrule
\\$\\backslash\\$end\{tabular\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.2 image/eg-booktabs.png \\%\\%
,,,
* create a table top rule with a 5 point width
>> \\$\\backslash\\$toprule[5pt]
* draw a table bottom rule (horizontal line) with a width of 3 points
>> \\$\\backslash\\$bottomrule[3pt]
* create a horizontal rule which only spans the 1 and second columns
>> \\$\\backslash\\$cmdirule\{1-2\}
* draw a horizontal rule spanning columns 1 \\& 2, with a width of 2 points
>> \\$\\backslash\\$cmdirule[2pt]\{1-2\}
* a rule on columns 2 \\& 3, width 2pt, trimmed on the left and on the right .75em
>> \\$\\backslash\\$cmdirule[2pt](lr\{.75em\})\{2-3\}
* add 3 points of space just before the bottom line of the table
>> \\$\\backslash\\$\\$\\backslash\\$ \\$\\backslash\\$addlinespace[3pt] \\$\\backslash\\$bottomrule
DISPLAYING KEYSTROKES
* search for the help file for the 'keystroke' package
>> find \texttt{/usr/share} -name 'key-test.pdf'
see the file 'key-test.pdf' for a complete list of the possible keystroke
commands.
* insert a graphical representation of keyboard keys
----------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{keystroke\}
\\$\\backslash\\$begin\{document\}
Press the \\$\\backslash\\$Esc key
\\$\\backslash\\$end\{document\}
\\%\\% =2.8 image/eg-keystroke-esc.png \\%\\%
,,,
* insert graphical representations of keyboard keys
----------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{keystroke\}
\\$\\backslash\\$begin\{document\}
hit the \\$\\backslash\\$keystroke\{F10\} function key
and then \\$\\backslash\\$Enter
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-keystroke-f10.png \\%\\%
,,,
DRAWING IN LATEX
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents tools to draw and graph in latex
.. picture - the built in latex drawing tools
.. xy - simple drawing
.. TikZ - advanced diagrams
.. PGF -
.. gnuplot - an external plotting tool
..
@@ \url{http://www.texample.net/tikz/examples/}
examples of using tikz and pgf charting tools
DRAWING LINES ....
* draw a line at 45 degrees north east, starting at point 0.0
-------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
Testing \\$\\backslash\\$LaTeX\{\} drawing
\\$\\backslash\\$setlength\{\\$\\backslash\\$unitlength\}\{5cm\}
\\$\\backslash\\$begin\{picture\}(1,1)
\\$\\backslash\\$put(0,0)\{\\$\\backslash\\$line(1,1)\{.5\}\}
\\$\\backslash\\$end\{picture\}
With Text
\\$\\backslash\\$end\{document\}
,,,
* draw a 1cm line at nearly 45 degrees, starting at point 0,0
-------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
Testing \\$\\backslash\\$LaTeX\{\} drawing
\\$\\backslash\\$setlength\{\\$\\backslash\\$unitlength\}\{5cm\} \\% 1 unit = 5cm
\\$\\backslash\\$begin\{picture\}(1,1) \\% create a 5cm x 5cm drawing box
\\$\\backslash\\$put(0,0)\{\\$\\backslash\\$line(6,5)\{0.2\}\} \\% start at 0,0 angle 6,5
\\$\\backslash\\$end\{picture\}
More Text
\\$\\backslash\\$end\{document\}
,,,
DRAWING ARROWS ....
* draw some arrows and a line, using different thicknesses
----------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$setlength\{\\$\\backslash\\$unitlength\}\{10mm\} \\% a 1cm drawing length
\\$\\backslash\\$begin\{picture\}(4,4) \\% a 40mm x 40mm drawing box
\\$\\backslash\\$put(2,2)\{\\$\\backslash\\$vector(4,1)\{1\}\} \\% an arrow, 1cm length, start 2,2
\\$\\backslash\\$thicklines \\% make all lines thick, from now on
\\$\\backslash\\$put(2,2)\{\\$\\backslash\\$vector(-4,1)\{1\}\} \\% length 10mm, start 2,2, angle -4,1
\\$\\backslash\\$put(0,0)\{\\$\\backslash\\$line(6,5)\{1\}\} \\% length 10mm, start at 0,0 angle 6,5
\\$\\backslash\\$thinlines \\% all lines thin from now on
\\$\\backslash\\$put(2,2)\{\\$\\backslash\\$vector(-1,-1)\{1\}\} \\% length 10mm, start 2,2, angle -1,-1
\\$\\backslash\\$end\{picture\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-vector.png \\%\\%
,,,
* display a 2x2 matrix with arrow pointing in a clock-wise direction
--------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{xy\}
\\% this is not working
\\%
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{displaymath\}
\\$\\backslash\\$xymatrix\{ A \\$\\backslash\\$ar[r] \\& B \\$\\backslash\\$ar[d] \\$\\backslash\\$\\$\\backslash\\$
D \\$\\backslash\\$ar[u] \\& C \\$\\backslash\\$ar[l] \}
\\$\\backslash\\$end\{displaymath\}
\\$\\backslash\\$end\{document\}
,,,
LISTING SOURCE CODE
* the simplest way to include source code
-----------------------------------------
\\$\\backslash\\$begin\{verbatim\}
source code
\\$\\backslash\\$end\{verbatim\}
,,,
USING THE LISTINGS PACKAGE ....
@@ \url{http://stackoverflow.com/questions/741985/latex-source-code-listing-like-in-professional-books}
good tips about professional listings
@@ \url{http://texblog.wordpress.com/2008/04/02/include-source-code-in-latex-with-listings/}
THE GOTCHAS ........
00- the command \\$\\backslash\\$begin\{lstlisting\} should not have anything after
or errors will be produced
- The basic style should always include \\$\\backslash\\$ttfamily
"basicstyle=\\$\\backslash\\$ttfamily"
- it is probably always a good idea to use
"breaklines=true" or just "breaklines" so that the ends of
long code lines do not disappear
SIMPLE USAGE ........
* list program source code in a latex document
----------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[frame=single, language=bash]
for f in \\$(ls *.txt)
do
cat \\$f; file \\$f
done
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.45 image/eg-listings-simple.png \\%\\%
,,,
* include an external file of program source code in a latex document
---------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstinputlisting\{filename.java\}
\\$\\backslash\\$end\{document\}
,,,
* add line-numbers, fixed pitch font and a frame to the listing
---------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\% listings should always be 'ttfamily'
\\$\\backslash\\$lstset\{basicstyle=\\$\\backslash\\$ttfamily, numbers=left, frame=single\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[language=awk]
\\# Hello
BEGIN \{ print "Hello, World!" \}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-listings-ttfamily.png \\%\\%
,,,
LISTINGS WITH FRAMES ....
* frame=none|leftline|topline|bottomline|lines|single|shadowbox
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some frame options
.. framerule=2pt, set the width of the frame rules to 2 points
.. rulesep=4pt, set the space between double frame rules to 4 points
.. framesep=3pt, set the space between the frame and the listing
.. rulecolor=\\$\\backslash\\$color\{blue\}, set the colour of the frame rules to blue
.. rulesepcolor= , set the colour between double frame rules, or shadows
.. xmarginleft=1cm, a 1cm margin on the left (outside of the frame)
.. xmarginright=1cm, a 1cm margin on the right (outside of the frame)
.. framexleftmargin=17pt, margins inside a frame ?
.. framexrightmargin=5pt,
.. framexbottommargin=4pt,
..
* a java code listing, 5pt wide green left side bar, left margin 1cm
---------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color, listings\}
\\$\\backslash\\$lstset\{language=java, xleftmargin=1cm,
framerule=5pt, rulecolor=\\$\\backslash\\$color\{red\}, frame=l\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}
public class Main
\{
public static void main(String[] args)
\{ System.out.println(Math.ceil(5.5)); \}
\}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* display a listing with a frame, double frame on the bottom and left
---------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[frame=trBL]
for i:=maxint to 0 do
begin \{ do nothing \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* create a shadow box with a blue shadow with code in fixed pitch font
-------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color, listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{basicstyle=\\$\\backslash\\$ttfamily, frame=shadowbox, rulesepcolor=\\$\\backslash\\$color\{blue\}\}
\\$\\backslash\\$begin\{lstlisting\}
for i:=maxint to 0 do begin \{ do nothing \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* a code listing with a frame with diagonally opposite corners rounded
----------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{frameround=ftft\} \\% ne, se, sw, nw
\\$\\backslash\\$begin\{lstlisting\}[frame=trbl]
for i:=maxint to 0 do
begin \{ do nothing \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
BREAKING LONG CODE LINES ....
It is probably alway advisable to use the "breaklines" or
"breaklines=true" (which is the same) when using the listings package,
since if you do not, then some code lines will simply be truncated at the
right hand side of the page, leading to confusion and frustration for your
readers when they try to run the code which you have provided.
00- Some problems
-
you cant use math symbols in the "postbreak" or "prebreak" options
direction, in other words "postbreak=\\$\\$\\backslash\\$Rightarrow\\$" gives an error when
compiling with latex. So you have to use \\$\\verb|~|"\\$\\backslash\\$mbox\{\\$\\$\\backslash\\$mathsymbol\\$\}"
-
* break long code lines, mark the start of each broken line with a dagger
-------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[breaklines, postbreak=\\$\\backslash\\$dag]
for i:=maxint to 0 do begin \{ ...a long line... \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* break long lines, mark the start of broken lines with a diagonal arrow
------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\% how to use math symbols with "postbreak" or "prebreak"
\\$\\backslash\\$begin\{lstlisting\}[breaklines=true, postbreak=\\$\\backslash\\$mbox\{\\$\\backslash\\$tiny\\$\\$\\backslash\\$searrow\\$\}]
for i:=maxint to 0 do begin \{ ...a long line... \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* break long lines, mark the end of broken lines with a blue right arrow
-------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color, listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[breaklines,prebreak=\\$\\backslash\\$mbox\{\{\\$\\backslash\\$color\{blue\}\\$\\backslash\\$tiny\\$\\$\\backslash\\$rightarrow\\$\}\}]
for i:=maxint to 0 do begin \{ ...a long line... \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* break long lines, mark broken lines with double blue right arrow + space
--------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{color, listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[breaklines,prebreak=\\$\\backslash\\$mbox\{\{\\$\\backslash\\$color\{blue\}\\$\\backslash\\$tiny\\$\\$\\backslash\\$Rightarrow\\$\}\\$\\backslash\\$space\}]
for i:=maxint to 0 do begin \{ ...a long line... \} end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* break long lines, and indent the broken lines by 10 points
------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[breaklines, breakindent=10pt]
for i:=maxint to 0 do begin \{ ...a long line... \} end;
\\$\\backslash\\$end\{lstlisting\}
,,,
* only break long lines at white space
--------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[breaklines, breakatwhitespace]
for i :=maxintttto0o0dobegin\{crypticon..++;\}end;fori:=to0o0dobegin\{crypticon..++;\}end;fori:=maxintto0do
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
LISTING SPECIFIC LANGUAGES ....
* specify the language as java for a particular listing
-------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[language=java]
import java.util.*;
public class HelloDate \{
public static void main (String[] args) \{
System.out.println ("Hello");
\}
\}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
\\%\\% = image/eg-listings-language.png \\%\\%
,,,
* turn off syntax highlighting
>> language=\{\}
* indicate that text between '\\#\\#(' and ')' should be treated as a comment
>> morecomment=[s]\{\\#\\#(\}\{)\} \\#\\#(this should go in the \\$\\backslash\\$lstset\{...\} command)
* display text between '\\$\\verb|~|(' and ')\\$\\verb|~|' in grey, italic, fixed pitch font
>> moredelim=[s][\\$\\backslash\\$color\{grey\}\\$\\backslash\\$itshape\\$\\backslash\\$ttfamily]\{\\$\\verb|~|(\}\{)\},
* select the "77" dialect of Fortran
>> language=[77]Fortran
* select the "latex" dialect of the TeX typesetting language
>> language=[LaTeX]TeX
* select the "ansi" dialect of the c programming language
>> language=[ANSI]C
* some languages defined for the "listings" package
>> sh, bash, perl, TeX, Awk, HTML \\#\\#(many more languages a defined)
LISTINGS WITH CAPTIONS ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents listing caption options
.. captionpos=t|b - if the caption is displayed above/below the listing
.. abovecaptionskip= - the amount of space above the caption
.. belowcaptionskip= - amount of space below
..
* display a listing with a caption at the bottom, 2 horizontal frame lines
--------------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[frame=lines, captionpos=b, caption=\{basic java\}]
import java.util.*;
public class HelloDate \{
public static void main (String[] args) \{
System.out.println ("Hello");
\}
\}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.45 image/eg-listings-caption.png \\%\\%
,,,
* a listing with the caption "A finite loop" but no "Listing" label
-------------------------------------------------------------------,
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{frame=single, language=bash\}
\\$\\backslash\\$begin\{lstlisting\}[title=\{A Finite Loop\}]
for f in *; do sed 's/s/S/g' \\%f; done
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
\\%\\% =0.45 image/eg-listings-title.png \\%\\%
,,,
* a code listing with caption and label, using a reference to the label
------------------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[caption=\{Some code\},label=loop]
for i:=maxint to 0 do
begin \{ ... \} end;
\\$\\backslash\\$end\{lstlisting\}
\\% run pdflatex twice to resolve these references
See listing: \\$\\backslash\\$ref\{loop\}
\\$\\backslash\\$end\{document\}
,,,
* define a custom caption class to use with a listing
-----------------------------------------------------
\\% this produces a left align white on grey caption for the listing
\\$\\backslash\\$documentclass\{report\}
\\$\\backslash\\$usepackage\{color\}
\\$\\backslash\\$usepackage\{xcolor\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$usepackage\{caption\}
\\$\\backslash\\$DeclareCaptionFont\{white\}\{\\$\\backslash\\$color\{white\}\}
\\$\\backslash\\$DeclareCaptionFormat\{listing\}\{\\$\\backslash\\$colorbox\{gray\}\{\\$\\backslash\\$parbox\{\\$\\backslash\\$textwidth\}\{\\#1\\#2\\#3\}\}\}
\\$\\backslash\\$captionsetup[lstlisting]\{format=listing,labelfont=white,textfont=white\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[label=some-code,caption=Some Code]
public void here() \{ goes().the().code() \}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
COLOURFUL LISTINGS ....
* display a listing with a background colour
--------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings, color\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{backgroundcolor=\\$\\backslash\\$color\{yellow\}\}
\\$\\backslash\\$begin\{lstlisting\}[frame=single, framerule=0pt]
for i:=maxint to 0 do
begin j:=square(root(i)); end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* display a listing with pale blue background, using xcolor
-----------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings, xcolor\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{backgroundcolor=\\$\\backslash\\$color\{blue!10\}\}
\\$\\backslash\\$begin\{lstlisting\}[frame=single, framerule=0pt]
for i:=maxint to 0 do
begin j:=square(root(i)); end;
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* display a java listing with syntax colour highlight
-----------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage\{listings, color\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$lstset\{ \\%
language=Java,
keywordstyle=\\$\\backslash\\$color\{blue\}, commentstyle=\\$\\backslash\\$color\{darkgreen\},
stringstyle=\\$\\backslash\\$color\{red\}, basicstyle=\\$\\backslash\\$footnotesize,
emph=\{label\}\}
\\$\\backslash\\$begin\{lstlisting\}
public class Main \{
public static void main(String[] args) \{
Float fObj = new Float("10.50");
\}
\}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
* create a syntax highlighted listing with a background colour
--------------------------------------------------------------
\\$\\backslash\\$documentclass\{article\}
\\$\\backslash\\$usepackage[pdftex]\{color\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$definecolor\{stringcolor\}\{rgb\}\{0.20,0.50,0.20\}
\\$\\backslash\\$definecolor\{commentcolor\}\{rgb\}\{0.40,0.40,0.40\}
\\$\\backslash\\$definecolor\{keywordcolor\}\{rgb\}\{0.50,0.10,0.10\}
\\$\\backslash\\$definecolor\{idcolor\}\{rgb\}\{0.10,0.10,0.50\}
\\$\\backslash\\$definecolor\{bg\}\{rgb\}\{0.95,0.95,0.95\}
\\$\\backslash\\$lstset\{language=C,basicstyle=\\$\\backslash\\$ttfamily,keywordstyle=\\$\\backslash\\$color\{keywordcolor\},
commentstyle=\{\\$\\backslash\\$color\{commentcolor\}\\$\\backslash\\$itshape\},
stringstyle=\{\\$\\backslash\\$color\{stringcolor\}\},
identifierstyle=\\$\\backslash\\$color\{idcolor\}
backgroundcolor=\\$\\backslash\\$color\{bg\}\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[title=\{\\$\\backslash\\$large Calculate pi function\}]\{calculate\\_pi\\_mp\}
...
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
LISTINGS PACKAGE OPTIONS ....
* set options for all the listings in a document
>> \\$\\backslash\\$lstset\{...\}
* define a style name to be used with the \texttt{"style"} command
---------------------------------------------------------
\\$\\backslash\\$documentclass\{report\}
\\$\\backslash\\$usepackage\{listings\}
\\$\\backslash\\$lstdefinestyle\{javacode\}\{language=java, frame=lines\}
\\$\\backslash\\$begin\{document\}
\\$\\backslash\\$begin\{lstlisting\}[style=javacode]
public void here() \{ ... \}
\\$\\backslash\\$end\{lstlisting\}
\\$\\backslash\\$end\{document\}
,,,
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some listings package option examples
.. basicstyle=\\$\\backslash\\$footnotesize\\$\\backslash\\$ttfamily - make the text small and fixed pitch
.. numbers=left - put the numbers on the left
.. numberstyle=\\$\\backslash\\$tiny - make the line numbers tiny
.. stepnumber=2 - number every second line
.. numbersep=5pt - make the gap between numbers and text 5 points.
.. extendedchars=true - allow the display of non-ascii characters (??)
.. breaklines=true - break long code lines
.. postbreak=* - put a star character after each broken line
.. keywordstyle=\\$\\backslash\\$color\{red\} - colour keywords red (with "color" package)
.. captionpos=b - place the caption at the bottom of the listing
.. language=java, specify the language as java
.. title=\{important code\}, create a caption with no "Listing" label
.. aboveskip=, the amount of space above the listing
.. belowskip=, the amount of space below the listing
..
DEFINING NEW LATEX COMMANDS
* define a command to format file names
>> \\$\\backslash\\$newcommand*\{\\$\\backslash\\$file\}[1]\{\\$\\backslash\\$textnormal\{\\$\\backslash\\$texttt\{.\\#1\}\}\}
PACKAGES
* find what latex packages are currently installed locally
>> sudo find /* -iname "*.sty" | less
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents packages to investigate
..
.. tocbibind, to change the table of contents
.. natbib -
.. thumbpdf, to create thumbnails
.. pdfpages, to include other pdf documents in the current one
.. blindtext, ?
.. \\$\\backslash\\$usepackage[T1]\{fontenc\},
..
VIEWING LATEX AND COMPILED DOCUMENTS
* view a "device independent" dvi file
>> xdvi travel.dvi
* view the postscript document "list.ps"
>> gv list.ps
* view a pdf document
>> xpdf list.pdf
>> acroread list.pdf
COMPILING AND CONVERTING LATEX DOCUMENTS
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents programs to convert latex to other formats
.. dvipdfm, convert a dvi to a pdf
.. epstopdf, convert postscript figures to pdf format
.. convert, the "imagemagick" program can convert "dvi" to any imagee format
..
CONVERTING FROM LATEX ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents tools for converting to latex
.. dblatex - convert from docbook sources
.. hevea - latex to html, info, or plain text
.. pandoc - convert to latex from 'markdown' format
..
TO HTML ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents tools for converting to html
.. debian package: hyperlatex, tex4ht
.. latex2html -
.. htlatex -
.. pstoimg - part of latex2html, can crop
..
* translate a latex file to html using "latex2html"
>> latex eg.tex; latex2html eg.tex
latex2html can create 'chunked' html files from the
latex source.
CONVERTING TO LATEX ....
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents tools for converting to latex
.. jadetex - sgml or xml to latex
..
INTERACTIVE PDFLATEX COMPILING ....
When something goes wrong with your document the 'pdflatex' compiler
will start to ask you a whole series of annoying questions, some of
which have no possible answer.
* exit the interactive compiler immediately
>> X \\#\\#(but if pdflatex wants a filename, this wont work)
>> xabcde \\#\\#(the same, only the first letter matters)
* show some possible commands for the pdflatex compiler
>> z \\#\\#(any letter which is not a command will do)
* typing 'quit' and 'exit' dont work at all!
>> quit \\#\\#(No! this runs the 'q' run quietly, command)
>> exit \\#\\#(Noo!! this runs the 'e' edit file command)
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents compiler commands
.. X - exit immediately the compiler
.. H - show help for the immediate problem
.. R - just try to run and ignore errors
.. S, keep going trying to ignore the problem
..
COMPILING PROBLEMS AND GOTCHAS ....
it seems impossible to send the output of pdflatex to standard output (as
would be normal with Unix programs)
to get the table of contents and other figures the document must be
compiled twice.
if the latex document contains packages using a "pdftex" option, then
"pdflatex --output-format dvi file.tex" will produce a "pdf" output file
instead of a dvi output file for example: if you have
"\\$\\backslash\\$usepackage[pdftex]\{color\}" in the latex file it will not be possible to
produce a dvi output file.
If some of the pages are missing at the end of the document
do you have an extra \\$\\backslash\\$end\{document\} mistakenly in there somewhere?
* continue even if latex encounters errors, print all messages
>> \\$\\backslash\\$nonstopmode \\#\\#(at the top of the document)
>> -interaction nonstopmode \\#\\#(the same, but on the command line)
* continue even if latex encounters errors, print very few messages
>> \\$\\backslash\\$batchmode \\#\\#(at the top of the document)
>> pdflatex -interaction batchmode eg.tex \\#\\#(the same but on the command line)
* convert the latex document 'eg.tex' to a "png" image
>> latex eg.tex; convert eg.dvi eg.png
The imagemagick 'convert' tool supports most image formats
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents possible latex compile modes
.. batchmode
.. non‐stopmode
.. scrollmode -
.. errorstopmode - stops if an error is encountered
..
COMPILING TO PDF FORMAT ....
The simplest way to compile to pdf is just to use "pdflatex" with no
other options. Compiling to pdf using a "tool chain" of several
programs is the older method, and probably is now obsolete.
* compile to pdf using pdflatex
>> pdflatex eg.tex \\#\\#(produces a file "eg.pdf")
* compile 'test.tex' and save the pdf file as 'new.pdf'
>> pdflatex -jobname new test.tex
* compile 'file.tex' to pdf and save as 'out.pdf' using standard input
>> cat file.tex | pdflatex -jobname out
* compile a latex document to pdf using the full tool chain
>> latex eg.tex; dvips -Ppdf eg.dvi; ps2pdf eg.ps
>> pdflatex --output-format dvi eg.tex; dvips -Ppdf eg.dvi; ps2pdf eg.ps
* compile a latex document to pdf using dvipdfm
>> latex eg.tex; dvipdfm eg.dvi \\#\\#(not pdflatex)
>> pdflatex --output-format dvi eg.tex; dvipdfm eg.dvi
\\#\\#(this may be useful if the document contains postscript figures)
COMPILE TO POSTSCRIPT FORMAT ....
* compile a latex document to postscript
>> latex eg.tex; dvips eg.dvi
>> pdflatex --output-format dvi eg.tex; dvips eg.dvi
COMPILE TO DVI FORMAT ....
* compile a latex document to dvi
>> latex eg.tex
>> pdflatex --output-format dvi file \\#\\#(the same)
COMPILE TO IMAGE FORMATS ....
Use pstoimg, a very capable program.
* convert 'old.ps' to a png image
>> pstoimg -type png old.ps
* convert 'old.ps' to a png image cropping all the whitespace
>> pstoimg -type png -crop a old.ps
* convert 'old.ps' to a png image making it transparent
>> pstoimg -type png -crop a -trans old.ps
* convert to gif images, one per page, cropping whitespace
>> pstoimg -multi -out bar -type gif -crop a foo.ps
* convert 'file.pdf' to a high quality 'png' format file
>> convert -density 300 file.pdf file.png
* convert 'file.pdf' to a high quality 'png' format file, cropping space
>> convert -density 300 -trim file.pdf file.png
CONVERTING PDF TO OTHER FORMATS ....
* convert 'file.pdf' to a high quality png image
>> convert -density 300 file.pdf file.png
* convert 'file.pdf' to a high quality jpg image
>> convert -density 300 file.pdf file.jpg
* convert 'file.pdf' to a high quality png image, trimming whitespace
>> convert -density 300 -trim file.pdf file.png
* the same as above, but with the mysterious '+repage'
>> convert -density 300 -trim +repage file.pdf file.png
COMPILING WITH BIBTEX ....
* compile a document with a bibliography
----------------------------------------
pdflatex example.tex
bibtex example
pdflatex example.tex
pdflatex example.tex
...
,,,
LATEX COMPILER ERROR MESSAGES ....
* maybe you havent got a \\$\\backslash\\$documentclass directive
>> ! LaTeX Error: \\$\\backslash\\$usepackage before \\$\\backslash\\$documentclass.
* Too many columns in a table (or too many "\\&" column separators)
>> Extra alignment tab has been changed to \\$\\backslash\\$cr.
>> ! LaTeX Error: File `.cls' not found.
maybe you misspelled the \\$\\backslash\\$documentclass\{...\} name of
the class (or used a non-existant document class)
because pdf latex cant find the associated '.cls'
file.
* there is an unescaped "\\#" somewhere in the document
>> Illegal parameter number in definition of \\$\\backslash\\$Hy@tempa
* possibly an unescaped "\\%" or "\{" etc in an \\$\\backslash\\$item[] command
>> Paragraph ended before \\$\\backslash\\$@item was complete.
* I got this with an escaped "\{" as "\\$\\$\\backslash\\$\{\\$" in a \\$\\backslash\\$url\{...\} argument
>> TeX capacity exceeded, sorry [input stack size=1500]
TDS TEX DIRECTORY STRUCTURE
The tds, or 'tex directory structure' is an attempt at
standardising where certain files will be placed in any
given tex distribution (such as 'texlive' etc).
'texmf' means the tex installation folder.
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents some folders
.. texmf/tex/latex/ - location for '.sty' files
..
VIM AND LATEX
If a text document contains a latex document embedded in it
then it can be compiled to pdf from within 'vim' the text editor
by using custom commands in vim. This capability appears to
start to approximate 'literate' programming, which is a style
of programming where the documentation is created in an integrated
way with the program.
* compile to pdf from this to next blank line, save in 'new.pdf'
>> :.,/\\^ *\\$/w !pdflatex -jobname new
* compile to pdf all following lines (latex code) and save as 'texput.pdf'
>> :.,/\\^ *\\$/w !pdflatex
* make an abbreviation which creates a simple latex document
>> ab ltxd \\$\\backslash\\$documentclass\{article\}\\$\\backslash\\$begin\{document\}\\$\\backslash\\$end\{document\}
CREATING NEW VIM COMMANDS ....
Since vim has the ability to create new commands, we can create
simple commands to compile document fragments with 'pdflatex' and
view the result, all without actually leaving vim.
Put these new commands in the \texttt{/etc/vim/vimrc} file to make them
permanently available.
* 'Print' compiles the given line range to pdf, saving the output as 'new.pdf'
>> :com! -range -nargs=0 Print ,w !pdflatex -jobname new
>> :com! -range Print ,w !pdflatex -jobname new \\#\\#(same?)
* 'PP' compiles the line range to pdf, saving the output as 'texput.pdf
>> :com! -range Print ,w !pdflatex
>> com! -range Print ,w !pdflatex \\#\\#(within the 'vimrc' file)
* use the new command to compile the current paragraph to pdf
>> !apPrint
* 'Pdf' compiles a line range to pdf and then views the new file
>> :com! -range Pdf ,w !pdflatex; evince texput.pdf
* execute the new 'Pdf' command, using the current paragraph
>> !ap Pdf \\#\\#('' means hit that key)
* a command 'PP' which converts stuff between '---' and ',,,' to pdf
>> :com PP ?\\^ *---?+1,/\\^ *,,,/-1w !pdflatex
The above command 'PP' will move up the document to the first line
which starts with '---' and then move one line down (+1). Then
the command will search downwards for the first line which starts with
',,,' and once found, will move one line upwards (-1). The
command will then pipe this range of lines to the 'pdflatex' command.
* create a command which converts a fragment to an image, cropping
>> com! Pdfi ?\\^ *---?+1,/\\^ *,,,/-1w !sed 's/document\}/\\&\\$\\backslash\\$n \\$\\backslash\\$\\$\\backslash\\$pagestyle\{empty\}/' | pdflatex; convert -density 300 -trim texput.pdf new.jpg; gthumb new.jpg
I insert a '\\$\\backslash\\$pagestyle\{empty\}' above so that when the pdf file
is converted to an image and 'cropped' (whitespace trimmed
with '-trim') the page number does not create a large image.
EXAMPLE TEXT USING VIM COMMANDS ....
* make a command 'Blah' which inserts 200 words of random text
>> com! Blah r !shuf -n 200 \texttt{/usr/share/dict/words} | tr '\\$\\backslash\\$n' ' '
* make a command 'Blah' which inserts a give number of random words
>> com! -nargs=1 Blah r !shuf -n \texttt{/usr/share/dict/words} | tr '\\$\\backslash\\$n' ' '
The command above can be executed with ':Blah 30' to insert 30 random words
into the document. The text is inserted at the current cursor position.
This is useful when you are testing some latex command which requires a
considerable amount of example text.
COMPLEX VIM COMMANDS FOR LATEX ....
* a command which compiles/views the latex fragment on the current line
----------------------------------------------------------------------
\\# the command first strips of '\\#' comment characters at the start
\\# of the line to be compiled, and then adds a basic skeleton document
\\# around the latex code fragment
:command! Pdfl .w !sed 's/\\^ *\\$\\backslash\\$\\#//' | sed 's/\\^/\\$\\backslash\\$\\$\\backslash\\$documentclass\{article\}\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$begin\{document\}\\$\\backslash\\$n/' | sed '\\$s/\\$/\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$end\{document\}/' | pdflatex; evince texput.pdf
,,,
* a command to create an image out of a latex fragment with cropping
--------------------------------------------------------------------
\\# Command explanation:
\\# make a command 'Cofragment' which;
\\# takes the current line '.w', removes comment '\\#' characters
\\# from the front and back of the line 's/\\^ *\\$\\backslash\\$\\#//' etc. Then
\\# adds a latex skeleton document around the fragment. Then
\\# converts this document to pdf with 'pdflatex'. Then uses
\\# imagemagicks 'convert' tool to crop all unnecessary whitespace
\\# and convert to the jpeg format with the name 'new.jp' in the
\\# users image folder. Then views the new image with 'gthumb'
\\#
:com! Cofragment .w !sed 's/\\^ *\\$\\backslash\\$\\#//; s/\\$\\backslash\\$\\# *\\$//' | sed 's/\\^/\\$\\backslash\\$\\$\\backslash\\$documentclass\{article\}\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$pagestyle\{empty\}\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$begin\{document\}\\$\\backslash\\$n/' | sed '\\$s/\\$/\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$end\{document\}/' | pdflatex; convert -density 300 -trim texput.pdf \\$\\verb|~|/image/new.jpg; gthumb \\$\\verb|~|/image/new.jpg
,,,
* compile a fragment and specify the output image name
------------------------------------------------------
:com! -nargs=1 Cofragment .w !sed 's/\\^ *\\$\\backslash\\$\\#//; s/\\$\\backslash\\$\\# *\\$//' | sed 's/\\^/\\$\\backslash\\$\\$\\backslash\\$documentclass\{article\}\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$pagestyle\{empty\}\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$begin\{document\}\\$\\backslash\\$n/' | sed '\\$s/\\$/\\$\\backslash\\$n\\$\\backslash\\$\\$\\backslash\\$end\{document\}/' | pdflatex; convert -density 300 -trim texput.pdf \\$\\verb|~|/image/.jpg; gthumb \\$\\verb|~|/image/.jpg
,,,
SED AND LATEX
It is possible to use the venerable unix stream editor to create latex
documents from plain text ones. This is the idea behind 'markdown' and
'pandoc' but sometimes writing your own little sed script maybe the way to
achieve the result. As usual gnused is assumed.
* convert '[=image-file.ext]' to a centered latex image
-------------------------------------------------------
\\#!/bin/sed -rf
s/\\^ *\\$\\backslash\\$[= *([\\^]]*)\\$\\backslash\\$] *\\$/\\$\\backslash\\$
\\$\\backslash\\$\\$\\backslash\\$begin\{center\}\\$\\backslash\\$
\\$\\backslash\\$\\$\\backslash\\$includegraphics[width=0.4\\$\\backslash\\$\\$\\backslash\\$textwidth]\{\\$\\backslash\\$1\}\\$\\backslash\\$
\\$\\backslash\\$\\$\\backslash\\$end\{center\}/g;
,,,
TEXLIVE EXTRA PACKAGES
\title{}
\author{bumble.sourceforge.net}
\maketitle
\tableofcontents the texlive latex extra packages
.. ESIEEcv - Curriculum vit for French.
.. GuIT - The GuIT package.
.. HA-prosper - Patches and improvements for prosper.
.. Tabbing - Tabbing with accented letters.
.. a0poster - Support for designing posters on large paper.
.. abstract - Control the typesetting of the abstract environment.
.. achemso - LaTeX and BibTeX style for American Chemical Society.
.. acronym - Expand acronyms at least once.
.. adrconv - BibTeX styles to implement an address database.
.. adrlist - Using address lists in LaTeX.
.. akletter - Comprehensive letter support.
.. altfont - No caption.
.. answers - Styles for setting questions (or exercises) and answers.
.. appendix - Extra control of appendices.
.. arcs - Draw arcs over and under text
.. arrayjob - Array data structures for (La)TeX.
.. assignment - A class file for typesetting homework and lab assignments
.. attachfile - Attach arbitrary files to a PDF document
.. authorindex - Indexing citations by author names.
.. autotab - Generating tabular setups.
.. begriff - Typeset Begriffschrift.
.. beton - Use Concrete fonts.
.. bez123 - Support for Bezier curves.
.. bezos - Packages by Javier Bezos.
.. binomexp - The binomexp package.
.. bizcard - Typeset business cards.
.. blindtext - Producing 'blind' text for testing.
.. boites - Boxes that may break across pages
.. booklet - Aids for printing simple booklets.
.. bophook - Provides AtBeginPage hook.
.. boxhandler - The boxhandler package.
.. breakurl - Line-breakable \\$\\backslash\\$url-like links in hyperref when compiling via
dvips/ps2pdf.
.. bussproofs - The bussproofs package.
.. calendar - A package for calendars and timetables.
.. calrsfs - Nicer calligraphic letters.
.. calxxxx - Prints a card-size calendar for any year.
.. captcont - Retain float number accross several floats.
.. casyl - Typeset Cree/Inuktitut in Canadian Aboriginal Syllabics.
.. cbcoptic - Coptic fonts and LaTeX macros for usage and for philology.
.. ccaption - Continuation headings and legends for floats.
.. cd - Typeset CD covers.
.. cd-cover - The cd-cover package.
.. cdpbundl - Business letters in the Italian style
.. cellspace - The cellspace package.
.. changebar - Generate changebars in LaTeX documents.
.. chappg - The chappg package.
.. chapterfolder - Package that simplifies working with folder structure
.. circ - Macros for typesetting circuit diagrams.
.. cjw - A bundle of packages and classes.
.. clefval - Key/value support with a hash.
.. clock - Graphical and textual clocks for TeX and LaTeX.
.. cmdtrack - Check used commands
.. cmsd - A package including additional fd files.
.. codepage - Support for variant code pages.
.. colorinfo - Retrieve color model and values for defined colors.
.. combine - Bundle individual documents into a single document.
.. comment - Selectively include/excludes portions of text.
.. concprog - Concert programmes.
.. contour - Print a coloured contour around text.
.. cooking - Typeset recipes.
.. cool - The cool package.
.. coollist - The coollist package.
.. coolstr - The coolstr package.
.. cooltooltips - The cooltooltips package.
.. coordsys - Draw cartesian coordinate systems.
.. count1to - Set count1 to count9.
.. courseoutline - Prepare university course outlines
.. coursepaper - Prepare university course papers
.. coverpage - The coverpage package.
.. crossreference - Crossreferences within documents
.. crosswrd - Macros for typesetting crossword puzzles..
.. csquotes - Context sensitive quotation marks.
.. csvtools - Reading data from CSV files
.. cuisine - Typeset recipes.
.. currvita - Typeset a curriculum vitae.
.. cursor - No caption.
.. cv - A package for creating a curriculum vitae.
.. cwpuzzle - Typeset crossword puzzles.
.. dashbox - Draw dashed boxes.
.. dashrule - Draw dashed rules.
.. dateiliste - The dateiliste package.
.. datenumber - Convert a date into a number and vice versa.
.. datetime - Change format of \\$\\backslash\\$today with commands for current time.
.. decimal - LaTeX package for the traditional English decimal point
.. deleq - Flexible numbering of equations.
.. diagnose - A diagnostic tool for a TeX installation.
.. dialogl - Macros for constructing interactive LaTeX scripts.
.. dichokey - Construct dichotomous identification keys.
.. dinbrief - German letter DIN style.
.. directory - Address book.
.. dk-bib - Danish variants of standard BibTeX styles.
.. dnaseq - Format DNA base sequences.
.. docmfp - Document non-LaTeX code.
.. dotseqn - Flush left equations with dotted leaders to the numbers.
.. dpfloat - Support for double-page floats.
.. draftcopy - Identify draft copies.
.. draftwatermark - The draftwatermark package.
.. dropping - Drop first letter of paragraphs.
.. dtk - The dtk package.
.. dvdcoll - The dvdcoll package.
.. eCards - The eCards package.
.. easy - A collection of ``easy'' to use macros.
.. ebezier - Device independent picture enhancement
.. eemeir - Adjust the gender of words in a document.
.. egplot - No caption.
.. ellipsis - Fix uneven spacing around ellipses in LaTeX text mode.
.. elmath - Mathematics in Greek texts.
.. elpres - The elpres package.
.. em - The em package.
.. empheq - EMPHasizing EQuations.
.. emulateapj - No caption.
.. endfloat - Move floats to the end with markers where they belong.
.. endheads - The endheads package.
.. engpron - Helps to type the pronunciation of English words.
.. engrec - Enumerate with lower- or uppercase Greek letters.
.. enumitem - Control layout of itemize, enumerate, description.
.. envbig - Printing addresses on envelopes.
.. envlab - Facilates addressing envelopes or mailing labels.
.. epigraph - A package for typesetting epigraphs.
.. epiolmec - Typesetting the Epi-Olmec Language.
.. eqlist - Description lists with equal indentation.
.. eqname - Name tags for equations.
.. eqparbox - Create equal-widthed parboxes
.. esdiff - Simplify typesetting of derivatives.
.. esint - Extended set of integrals for Computer Modern.
.. esint-type1 - The esint-type1 package.
.. etaremune - Reverse-counting enumerate environment.
.. europecv - Unofficial class for European curricula vitae.
.. everypage - The everypage package.
.. exam - Package for typesetting exam scripts.
.. examdesign - LaTeX class for typesetting exams.
.. examplep - Verbatim phrases and listings in LaTeX.
.. exercise - A package to typeset exercises, problems, etc. and their answers
.. expdlist - Expanded description environments.
.. expl3 - Experimental packages demonstrating a possible LaTeX3 programming
convention.
.. export - Import and export values of LaTeX registers.
.. extract - Extract specific content from a source document and write that to a target document
.. facsimile - Document class for preparing faxes.
.. fancybox - Variants of \\$\\backslash\\$fbox.
.. fancynum - Typeset numbers.
.. figbib - Organize figure databases with BibTeX.
.. figsize - Auto-size graphics.
.. filecontents - Extended filecontents and filecontents* environments
.. fink - The LaTeX2e File Name Keeper.
.. fixfoot - Multiple use of the same footnote text
.. fixme - Insert "fixme" notes into draft documents.
.. flabels - Labels for files and folders.
.. flagderiv - The flagderiv package.
.. flashcards - A class for typesetting flashcards.
.. flippdf - The flippdf package.
.. floatrow - Extension or addition for float package.
.. flowfram - Create text frames for posters, brochures or magazines.
.. fmp - Include Functional MetaPost in LaTeX.
.. fmtcount - Display the value of a LaTeX counter in a variety of formats.
.. fnbreak - Warn for split footnotes.
.. fncychap - Six predefined chapter heading styles.
.. foilhtml - Interface between foiltex and LaTeX2HTML.
.. footmisc - A range of footnote options
.. footnpag - Per-page numbering of footnotes.
.. forloop - The forloop package.
.. formlett - Letters to multiple recipients.
.. formular - Create forms containing field for manual entry.
.. fribrief - A LaTeX class for writing letters.
.. fullblck - Left-blocking for letter class.
.. fullpict - Full page pictures.
.. fundus - Providing LaTeX access to various font families.
.. g-brief - Letter document class.
.. gauss - A package for Gaussian operations
.. genmpage - Generalization of LaTeX's minipages.
.. ginpenc - Modification of inputenc for German.
.. gloss - Create glossaries using BibTeX.
.. glossary - Create a glossary
.. gmdoc - The gmdoc package.
.. gmiflink - The gmiflink package.
.. gmutils - The gmutils package.
.. gmverb - The gmverb package.
.. graphicx-psmin - The graphicx-psmin package.
.. grfpaste - Include fragments of a dvi file.
.. hanging - Hanging paragraphs.
.. harpoon - Extra harpoons, using the graphics package.
.. hc - Replacement for the LaTeX classes.
.. hhtensor - Print vectors, matrices, and tensors.
.. histogr - Draw histograms with the LaTeX picture environment.
.. hitec - Class for documentation.
.. hpsdiss - A dissertation class.
.. hvfloat - Rotating caption and object of floats independently.
.. hyper - Hypertext cross referencing.
.. hyperxmp - The hyperxmp package.
.. hyphenat - Disable/enable hypenation.
.. ifmslide - Presentation slides for screen and printouts.
.. interactiveworkbook - latex-based interactive PDF on the web
.. invoice - Generate invoices.
.. ipa - No description available.
.. iso - Typesetting ISO International Standard documents
.. iso10303 - Typesetting ISO 10303 International Standard documents
.. isodate - Tune the output format of dates according to language.
.. isorot - Rotation of document elements.
.. isotope - A package for type setting isotopes
.. kalender - Style file for creating a calendar; in German.
.. kastrup - The kastrup package.
.. kerntest - Print tables and generate control files to adjust kernings.
.. keystroke - Graphical representation of keys on keyboard.
.. labbook - Typeset laboratory journals.
.. labelcas - The labelcas package.
.. labels - Print sheets of sticky labels.
.. lastpage - Reference last page for Page N of M type footers.
.. latex-tds - The latex-tds package.
.. layouts - Display various elements of a document's layout.
.. lazylist - Lists in TeX's "mouth"
.. lcd - Alphanumerical LCD-style displays.
.. lcg - Generate random integers.
.. leaflet - Create small handouts (flyers).
.. leftidx - Left and right subscripts and superscripts in math mode.
.. lettre - Letters and faxes in French.
.. lettrine - Typeset dropped capitals.
.. lewis - The lewis package.
.. lhelp - Miscelaneous helper pacakges.
.. limap - Typeset maps and blocks according to the Information Mapping method.
.. lipsum - Easy access to the Lorem Ipsum dummy text.
.. listliketab - Typeset lists as tables.
.. listofsymbols - Create and manipulate lists of symbols
.. lkproof - LK Proof figure macros.
.. localloc - Macros for localizing TeX register allocations.
.. logpap - Generate logarithmic graph paper with LaTeX.
.. lsc - The lsc package.
.. ltablex - Table package extensions.
.. ltabptch - Bug fix for longtable.
.. ltxindex - A LaTeX package to typeset indices with GNU's Texindex.
.. mailing - Macros for mail merging.
.. makebox - Defines a \\$\\backslash\\$makebox* command
.. makecell - Tabular column heads and multilined cells
.. makecirc - A METAPOST library for electrical circuit diagrams drawing.
.. makecmds - The new \\$\\backslash\\$makecommand command always (re)defines a command.
.. makedtx - Perl script to help generate dtx and ins files
.. makeglos - Include a glossary into a document.
.. manfnt - LaTeX support for the TeX book symbols.
.. manuscript - Emulate look of a document typed on a typewriter.
.. mapcodes - Support for multiple character sets and encodings.
.. maple - Styles and examples for the MAPLE newsletter.
.. marginnote - The marginnote package.
.. maybemath - Make math bold or italic according to context.
.. mcaption - The mcaption package.
.. mceinleger - Creating covers for music cassettes.
.. mcite - No caption.
.. menu - Typesetting menus.
.. method - Typeset method and variable declarations.
.. metre - Support for the work of classicists
.. mff - Multiple font formats.
.. mftinc - Pretty-print Metafont source.
.. minipage-marginpar - The minipage-marginpar package.
.. minitoc - Produce a table of contents for each chapter.
.. minutes - Package for writing minutes of meetings.
.. misc209 - Miscellaneous LaTeX packages
.. mla-paper - Proper MLA formatting.
.. moderncv - The moderncv package.
.. modroman - Write numbers in lower case roman numerals.
.. morehelp - No caption.
.. moresize - Allows font sizes up to 35.83pt.
.. moreverb - Extended verbatim.
.. movie15 - Multimedia inclusion package.
.. mparhack - A workaround for a LaTeX bug in marginpars.
.. msc - Draw MSC diagrams.
.. msg - A package for LaTeX localisation.
.. mslapa - Michael Landy's APA citation style.
.. mtgreek - Use italic and upright greek letters with mathtime
.. multenum - Multi-column enumerated lists.
.. multibbl - Multiple bibliographies.
.. multicap - Format captions inside multicols
.. multirow - Creates tabular cells spanning multiple rows.
.. multitoc - Set table of contents in multiple columns.
.. mwrite - Write information to files.
.. nag - Detecting and warning about obsolete LaTeX commands
.. namespc - Rudimentary c++-like namespaces in LaTeX.
.. ncclatex - An extended general-purpose class
.. ncctools - A collection of general packages for LaTeX
.. newfile - User level management of LaTeX input and output.
.. newlfm - Write letters, facsimiles, and memos.
.. newthm - No caption.
.. newvbtm - Define your own verbatim-like environment.
.. noitcrul - The noitcrul package.
.. nomencl - Produce lists of symbols as in nomenclature.
.. nomentbl - Nomenclature typeset in a longtable
.. nonfloat - Non-floating table and figure captions.
.. notes - Mark sections of a document.
.. ntabbing - Simple tabbing extension for automatic line numbering.
.. ntheorem - Enhanced theorem environment.
.. numprint - Print numbers with separators and exponent if necessary.
.. ocr-latex - The ocr-latex package.
.. octavo - The octavo package.
.. oldstyle - Old style numbers in OT1 encoding.
.. onlyamsmath - The onlyamsmath package.
.. opcit - Footnote-style bibliographical references.
.. outline - List environment for making outlines.
.. outliner - Change section levels easily.
.. overpic - Combine LaTeX commands over included graphics.
.. oxford - A BibTeX style of citations for the humanities.
.. pageno - Page number-only page styles.
.. pagenote - Notes at end of document.
.. paper - Versions of article class, tuned for scholarly publications.
.. papercdcase - The papercdcase package.
.. papertex - The papertex package.
.. paralist - Enumerate and itemize within paragraphs.
.. paresse - Defines macros for greek letters
.. patch - Macros for package management.
.. patchcmd - Change the definition of an existing command.
.. pauldoc - The pauldoc package.
.. pawpict - Using graphics from PAW.
.. pbox - A variable-width \\$\\backslash\\$parbox command.
.. pbsheet - Problem sheet class.
.. pdfcprot - Activating and setting of character protruding using pdflatex.
.. pdfscreen - Support screen-based document design.
.. pdfslide - Presentation slides using pdftex.
.. pdfsync - The pdfsync package.
.. pdfwin - Customizable windows for screen output.
.. pecha - A LaTeX class to print Tibetan text in the classic pecha layout style.
.. perltex - Define LaTeX macros in terms of Perl code
.. permute - Support for symmetric groups.
.. photo - A float environment for photographs.
.. pittetd - Electronic Theses and Dissertations at Pitt.
.. placeins - Control float placement.
.. plates - Arrange for "plates" sections of documents.
.. plweb - The plweb package.
.. polyglot - A package for LaTeX2e multilingual support.
.. polynom - Macros for manipulating polynomials.
.. polytable - Tabular-like environments with named columns.
.. postcards - Facilitates mass-mailing of postcards (junkmail).
.. ppr-prv - Prosper preview.
.. prelim2e - Allows the marking of preliminary versions of a document.
.. preprint - A bundle of packages provided "as is".
.. prettyref - Make label references "self-identify".
.. probsoln - generate problem sheets and their solution sheets
.. program - Typesetting programs and algorithms.
.. progress - Creates an overview of a documents' state.
.. protocol - Typeset meeting protocols.
.. psfragx - A psfrag eXtension
.. pst-pdf - The pst-pdf package.
.. qcm - A LaTeX2e class for making multiple choice questionnaires
.. qsymbols - Maths symbol abbreviations.
.. quotchap - Decorative chapter headings.
.. ragged2e - Alternative versions of "ragged"-type commands
.. randtext - The randtext package.
.. rccol - Right-centered optionally rounded numbers in tabular.
.. rcsinfo - Support for the revision control system.
.. rectopma - Recycle top matter.
.. refcheck - Check references (in figures, table, equations, etc).
.. refman - Format technical reference manuals.
.. refstyle - Advanced formatting of cross references.
.. regcount - Display the allocation status of the TeX registers.
.. register - Typeset programmable elements in digital hardware (registers).
.. relenc - A "relaxed" font encoding.
.. repeatindex - Repeat items in an index after a page or column break
.. resume - The resume package.
.. rlepsf - No caption.
.. rmpage - A package to help change page layout parameters in LaTeX.
.. robustcommand - The robustcommand package.
.. robustindex - Create index with pagerefs.
.. romannum - Generate roman numerals instead of arabic digits.
.. rotfloat - Rotate floats.
.. rotpages - Typeset multiple pages upside-down with page order rearrangement
.. rst - Drawing rhetorical structure analysis diagrams in LaTeX
.. rtkinenc - Input encoding with fallback procedures.
.. sauerj - A bundle of utilities by Jonathan Sauer.
.. savefnmark - Save name of the footnote mark for reuse.
.. savesym - Redefine symbols where names conflict.
.. savetrees - Pack as much text as possible onto each page of a LaTeX document.
.. scale - Scale document by sqrt(2) or magstep(2).
.. scalebar - Create scalebars for maps, diagrams or photos.
.. schedule - Weekly schedules.
.. sciwordconv - Scientific Word/WorkPlace source files with another TeX.
.. script - Variant report / book styles.
.. sectionbox - The sectionbox package.
.. sectsty - Control sectional headers.
.. semantic - Help for writing programming language semantics.
.. semioneside - The semioneside package.
.. seqsplit - The seqsplit package.
.. sf298 - Standard form 298.
.. sffms - Typesetting science fiction/fantasy manuscripts.
.. shadbox - Shade the background of any box.
.. shadethm - Theorem environments that are shaded.
.. shapepar - A macro to typeset paragraphs in specific shapes.
.. shortlst - Compact lists by running several items per line.
.. shorttoc - Table of contents with different depths.
.. showdim - Variants on printing dimensions.
.. showexpl - The showexpl package.
.. showlabels - Show label commands in the margin.
.. sidecap - Typeset captions sideways.
.. slantsc - Access different-shaped small-caps fonts.
.. slashbox - Dual headings in tabular columns.
.. slidenotes - No caption.
.. smalltableof - Create listoffigures etc. in a single chapter.
.. smartref - Extend LaTeX's \\$\\backslash\\$ref capability.
.. smflatex - Classes conforming to Soci\\$\\backslash\\$'et\\$\\backslash\\$'e math\\$\\backslash\\$'ematique de France.
.. snapshot - List the external dependencies of a LaTeX document.
.. soul - Hyphenation for letterspacing, underlining, and more.
.. sparklines - Drawing sparklines: intense, simple, wordlike graphics.
.. splitbib - Split and reorder your bibliography.
.. splitindex - Unlimited number of indexes.
.. spotcolor - The spotcolor package.
.. sprite - Macros to set bitmaps with TeX.
.. srcltx - Jump between DVI and TEX files.
.. sseq - Spectral sequence diagrams.
.. ssqquote - Use the cmssq fonts.
.. stack - Tools to define and use stacks.
.. statistik - Store statistics of a document.
.. stdclsdv - Provide sectioning information for package writers.
.. stdpage - Standard pages with n lines of at most m characters each.
.. sttools - Various macros.
.. subeqn - Package for subequation numbering.
.. subeqnarray - Equation array with sub numbering.
.. subfigure - Figures divided into subfigures.
.. subfloat - Sub-numbering for figures and tables.
.. substr - Deal with substrings in strings.
.. supertabular - A multi-page tables package.
.. svgcolor - The svgcolor package.
.. svn - Typeset Subversion keywords
.. svn-multi - The svn-multi package.
.. svninfo - Typeset Subversion Keywords.
.. syntax - Drawing syntax diagrams
.. syntrace - The syntrace package.
.. synttree - Typeset syntactic trees.
.. tabto-ltx - The tabto-ltx package.
.. tabulary - The tabulary package.
.. talk - The talk package.
.. taupin - The taupin package.
.. tcldoc - Old name for tclldoc.
.. technics - A package to format technical documents.
.. texlogos - Ready-to-use LaTeX logos.
.. texmate - Comprehensive chess annotation in LaTeX.
.. texshade - Package for setting nucleotide and peptide alignments.
.. textcase - The textcase package.
.. textfit - Fit text to a desired size.
.. textmerg - Merge text in TeX and LaTeX.
.. textpos - Place boxes at absolute positions.
.. thumb - Thumb marks in documents.
.. ticket - Make labels, visting-cards, pins with LaTeX.
.. timesht - Package for typesetting time sheets.
.. timing - Fonts and macro package for drawing timing diagrams.
.. titlefoot - Add special material to footer of title page.
.. titlesec - Select alternative section titles.
.. titling - Control over the typesetting of the \\$\\backslash\\$maketitle command.
.. tocbibind - Add bibliography/index/contents to Table of Contents.
.. tocloft - Control table of contents, figures, etc.
.. tocvsec2 - Section numbering and table of contents control.
.. todo - Make a to-do list for a document.
.. tokenizer - A tokenizer.
.. toolbox - Macros for writing indices, glossaries.
.. topfloat - Move floats to the top of the page.
.. totpages - Access last page number and page mark of last page.
.. tracking - Adjust tracking of strings.
.. trfsigns - Typeset transform signs.
.. trsym - The trsym package.
.. twoup - Print two virtual pages on each physical page.
.. type1cm - No caption.
.. typedref - Eliminate errors by enforcing the types of labels.
.. typogrid - Print a typographic grid.
.. ulsy - Extra mathematical characters.
.. umoline - Underline text allowing line breaking.
.. underlin - Multi-word underlining.
.. undertilde - Typeset a tilde under one (or many) maths symbols.
.. units - Typeset units.
.. upquote - Show "realistic" quotes in verbatim.
.. ushort - Shorter (and longer) underlines and underbars.
.. varindex - Luxury frontend to the \\$\\backslash\\$index command.
.. vector - No caption.
.. versions - Optionally omit pieces of text.
.. vhistory - The vhistory package.
.. vita - Configurable class for curricula vitarum.
.. vmargin - Set various page dimensions.
.. volumes - Typeset only parts of a document, with complete indexes etc.
.. vpe - The vpe package.
.. vrsion - Add version number to DVI file.
.. wallpaper - Easy addition of wallpapers (background images) to LaTeX documents, including tiling.
.. warning - Global warnings at the end of the logfile.
.. warpcol - Relative alignment of rows in numeric columns in tabulars.
.. was - A collection of small packages by Walter Schmidt.
.. webeq - A series of packages for online education.
.. williams - Miscellaneous macros by Peter Williams.
.. wordcount - Estimate the number of words in a LaTeX document.
.. wordlike - The wordlike package.
.. wrapfig - Produces figures which text can flow around.
.. xbmc - Skeleton package.
.. xdoc - Extending the LaTeX doc system.
.. xifthen - The xifthen package.
.. xmpincl - Include "eXtensible Metadata Platform" data in pdflatex
.. xytree - The xytree package.
.. yafoot - Miscellaneous footnote commands.
.. yplan - Daily planner type calendar.
.. zed-csp - Typesetting Z and CSP format specifications.
.. bin-perltex - Define LaTeX macros using Perl
.. xmlplay - Typeset Shakespeare's plays as marked up by Bosak.
.. bigfoot - The bigfoot package.
TEX DISTRIBUTIONS
@@ \url{http://www.tug.org/texlive}
the texlive home page
* telive, tetex, xetex etc, miktex
PUBLISHED BOOKS CREATED WITH LATEX
This list of books created with latex is designed to give the reader
and idea of what latex is capable of producing.
Unix, Programacion Avanzada (Marquez, Alphaomega press)
This is a extremely well presented technical book about
unix programming written in spanish
DOCUMENT-NOTES:
\\# this section contains information about the document and
\\# will not normally be printed.
\\# A small image to represent the document in folder lists etc
document-icon: \texttt{/img/icon/tex-icon.ico}
\\# A larger image.
document-image:
\\# what sort of document is this
document-type: book
\\# in what kind of state (good or bad) is this document
document-quality: average
document-history:
@@ 2009
document created as part of an effort to produce some printed
documents for a visa application.
@@ january 2010
minor revisions
@@ feb 2010
adding some information about the 'xcolor' package
@@ 29 april 2010
tidying up the tables section and adding some better looking
examples of alternate colour tables and rotated heading
tables.
@@ 8 may 2010
a few notes about tables, discovered that you can have
alternate colour row tables without using the 'tabularx'
package.
\\# who wrote this document
authors: mjbishop at fastmail dot fm
\\# a short description of the contents, possibly used for doc lists
short-description: recipes and tricks to produce nice documents with LaTeX
\\# A computer language contained in the document
code-language: TeX
\\# the script which will be used to produce html (a webpage)
make-html: ./booktohtml.cgi
\\# the script which will produce 'LaTeX' output (for printing, pdf etc)
make-latex: ./booktolatex.cgi
\\# how long the document is taking to compile with pdflatex
compile-time: \\$\\verb|~| 35s (per pdflatex run)
\end{document}
%end generated latex