GreyMamba

Thinking Allowed … (under construction)

Thinking Allowed … (under construction)

A computer once beat me at chess, but it was no match for me at kick boxing.
Emo Philips
Snippets covering IT techniques, Python coding and Rapidweaver
Just a section to cover anything related to 'Information Technology'. Computers, Coding, Algorithms, A.I. and so on. There will probably be quite a bit on how to make a web site (one of the reasons I'm actually doing this is to learn how) including much on Rapidweaver and Stacks. There will be code - most likely Python along with general computery items.

I'm quite into Python programming and as such I've written a bit of an interactive Python booklet (link opens in new window) covering some of the stuff needed to program in it.

It's probably appropriate to mention here that I've used RapidWeaver 8 to help me generate this website. I've also made use of the excellent Free DNS service to overcome the limitations imposed by not having a static IP address.

LaTeX

LaTex is technically a typesetting system. To quote the opening paragraph on the LaTeX project page:

LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents. LaTeX is available as free software.

When you first come across it, it does seem to be quite intimidating as you don’t just press buttons to get a ‘near enough’ output but have to include esoteric ‘codes’ into your text to make something happen. You don’t immediately see the results but have to ‘compile’ the results to get a final output. Actually there are a few WYSIWIG LaTeX systems out there but that misses the point somewhat.

So why bother when something like Microsoft Word or LibreOffice (free!) do a pretty reasonable job? Well it’s because you do get precise control of the finished document. If you want all equations indented by ¾ inches and numbers in brackets that are right justified then fine – just do it. If you want that image to be a precise 55mm by 75mm and embedded at the centre of flowed text columns then no problem. Yes you might need to work a bit harder initially but you will get what you intend – and when you add a bit to a paragraph later your formatting won’t all go to rats! You can see that I’ve been deeply damaged in the past can’t you?

So latex uses ‘codes’ to do the business. What do they look like? Let’s look at a basic example (once again on the LaTeX web site:

\documentclass{article}
\title{Cartesian closed categories and the price of eggs}
\author{Jane Doe}
\date{September 1994}
\begin{document}
   \maketitle
   Hello world!
\end{document}

As you can see there the general form is some kind of instruction, identified by a ‘\’ (‘\maketitle’ for example) and what it applies to in braces (‘{‘ ‘}’). Sometimes a whole block is identified by using \begin an \end.

Now, looking at the example, if this were to be ‘rendered’ it would produce the output below:

Stacks Image 153

This might seem a lot of bother but the power comes with more complex examples. In this case we have a simple ‘documentclass’ which is identified as an ‘article’. The renderer can then interpret \title, \author etc. and format them appropriately. But we can modify this by adding some extra ‘options’ hence \documentclass[twoside]{article} would produce double sided output. You can add further abilities by including other pre-prepared packages. For example there is the ability to use Encapsulated PostScript (EPS) figures – don’t ask – easily by using:

\documentclass[twoside]{article} \usepackage{epsfig}

In other words the system is highly extensible. And here’s the real joy, most journals provide appropriate packages that will automatically typeset your paper exactly as they want it, providing additional codes for your delectation! So, you get everything you need AND the ability to tweak things as you see fit.

From my point of view writing these web pages, I can use the MathJax system to easily embed LaTeX equations wherever I want them. MathJax interprets and renders LaTex code. So writing something like $$x = {-b \pm {\sqrt{b^2-4ac} \over 2a}}$$ gives:

\[x = {-b \pm {\sqrt{b^2-4ac} \over 2a}}\]

Way easier than using, say, the Word equation editor and trying to embed the output.

You can, of course also write your own rules/instructions/commands like this: $$\newcommand{\water}{H_{2}O}$$ \[\newcommand{\water}{H_{2}O}\] and use them like this: The equation for water is:\\(\water\\) - giving … The equation for water is: \(\water\)

If you want to knock up a quick document then stick with WYSIWIG (I’d use LibreOffice – did I mention that it’s free?). But if you’re writing for a scientific journal then learn the basics of LaTeX it will help you no end in the future.

Back

Nice photo from an unusual perspective. Kudos to Joshua Sortino

RapidWeaver Icon

Made in RapidWeaver