Wednesday, February 13, 2019

Making LaTeX work

If you are a "normal" person, you've probably never heard of LaTeX (pronounced "lay-tech"). It's a text processing system in which, rather than WYSIWYG, you mark up your code as you write it, and then compile it - typically into a PDF. The appearance can be startlingly attractive - Donald Knuth, who is basically one of the people who invented computer science, apparently said that TeX, which underlies it, was intended for the creation of beautiful books — and especially for books that contain a lot of mathematics”. Beyond maths, its use extends to pretty much any field where you want to add content that is more than simple Roman text - chemistry, non-Latin characters, bibliographies...

The trouble is that it suffers from CompSci disease - which I think I can summarise as being that the assumption is made by most people using it that time spent learning about how to install and use it is time well spent - rather than simply time that is lost from the project that actually needs to be done. Error codes are opaque, software has hidden dependencies which mean that it doesn't work and won't tell you why not, and instructions assume that you will take delight in spending several evenings working through a tutorial gradually getting up to speed - rather than wanting basically to be able to do this NOW. LaTeX devotees in universities will demand that students or supervisees will do stuff in LaTex because "it gives the best results" - this feels like the CompSci equivalent of chucking a non-swimmer into the river above Niagara Falls ...

So what's the best way to do anything with LaTeX? I don't know the best way, but last night, I did manage to find one that works. I installed MiKTeX. Unlike TeXMaker and TeXworks (as a platform on its own - actually MiKTeX invokes TeXworks), it downloaded everything it needed to work straight away. Also, it automatically updated everything. Also, rather than grumbling when it needed something that it couldn't have (extra skills beyond the core functionality), it just went and found the library it needed on the internet. This basically brings LaTeX into the realm of normal computer users rather than computer specialists.

I then spent a while getting to grips with some of the basic instructions. The "Hello World" of LaTex looks like this:

\documentclass[12pt]{article}
\begin{document}
Hello world!
\end{document}

(Computer guys, do you know how INFURIATING it is when you install a package and even this doesn't work out of the tin???!!!)

Then, with a little more exploring, I came up with:

\documentclass[12pt]{article}
\usepackage{chemfig}
\begin{document}
\title{A \LaTeX\ Sampler}
\author{Joe Author}
\maketitle
\section{The first section}
\subsection{The first subsection}
Now is the winter of our discontent\\made glorious summer by this son of York \\ \\
\noindent
\texttt{Here is some teletype text}\\
\textbf{Here is some bold text}\\
\textit{Here is some italic text}\\


\chemfig{C(=[:0]C(-[:60]H)(-[:300]H))(-[:120]H)(-[:240]Cl)}
\begin{thebibliography}{1}
\bibitem {Shakespeare 1604}Shakespeare, W., \textit{Richard III}, Stratford, Reprinted 2016.
\end{thebibliography}
\end{document}
What bits and pieces do we have here? It includes ... how to invoke libraries (chemfig, in this case, for the molecule that it draws!!), how to create and display a title, sections and subsections, how to do bold, italic and fixed fonts, and how to set up a bibliography. I also found a usable online reference for LaTex, at Wikibooks.

Basically, this one post that I have written is what I was not able to find on the internet, which is "How to get up and running with LaTex fast, and have access to the information you need to make more progress with it."

No comments: