LaTeX Tutorial videos from ShareLaTeX

Learning LaTeX without a ‘local guide’ can be a challenge: it’s one of the reasons I’m involved in running training courses for UK-TUG. The people behind ShareLaTeX have decided to make a series of videos aimed at newer LaTeX users, covering the basics of LaTeX use, writing a thesis and also some more advanced topics (TikZ and beamer, for example).

There are currently about 25 videos, and I’ve watched all of the ‘basic’ ones (the LaTeX beginners series and the thesis series). The quality and presentation is pretty good: as well as well produced videos there are also transcripts for all of them, and of course the demos are available on ShareLaTeX. Of course, there are a few things I’d tackle differently, but the overall picture is pretty impressive. They’ve put a lot of work into the videos, and if you work through carefully (and take time to try the demos yourself) them I think you’ll get a good grounding in using LaTeX.

Beamer and \subsubsection

I’m hoping to address a few bugs in beamer over the next few days. One category that is always tricky is things linked to using \subsubsection. If you’ve read the beamer manual carefully, you’ll know that the original author of the class really didn’t want people to use \subsubsection in talks. However, he also didn’t ban it entirely, leaving me with a tricky situation. The problem is that while \subsubsection works, many of the things you might expect to happen from the relationship between \section and \subsection fail with \subsubsection, and from the code that may well be ‘by design’. Of course, I can change the ‘rules’, but beamer has been around a long time and it’s also somewhat complex code. As such, I’m always having to make judgements on how to deal with these bugs. My advice: don’t use \subsubection in beamer documents! Certainly don’t be surprised if when you ignore that advice odd things happen.

Customising TeXworks auto-completion

TeXworks is a very flexible editor, and one of the things you can customise, if you want, is the set of auto-completion values it knows. For those of you who are not familiar with it, TeXworks uses a simple list of simple completion options, so when I type

\doc

I can press the Tab key and be offered

\documentclass{}

and if I press Tab again,

\documentclass[]{}

That’s very useful, but some of the auto-complete options are not ones I use a lot. There are also a few inconsistencies in how the results are formatted: while TeXworks inherited a basic set from TeXShop, it also comes with some additions and they don’t always quite agree on how things should work! So I’ve been looking a bit at sorting out my own custom set, adding things I use, removing ones I don’t and so on.

The basic format for the auto-complete files is to have a first line for the encoding

%% !TEX encoding = UTF-8 Unicode

then one or more lines for each completion. Each line can either just have a completion vale

\alpha

or have a ‘shortcut’ text version

xa:=\alpha

There are then a few bits of ‘helper’ syntax. You can use #INS# to show where the cursor should end up, #RET for a return and as a marker you can jump to using Ctrl-Tab (Option-Tab on the Mac). So for example the \documentclass lines read

\documentclass{#INS#}#RET#
\documentclass[#INS#]{•}#RET#

I’m told that TeXShop has extended the syntax a bit, but at least at the moment in TeXworks that all there is to know.

So what have I done to customise the files? TeXworks comes with four auto-complete files, but the values offered simply come from them all together (you can’t currently select only some files). (You might wonder where these files live: they are ‘hidden away’: TeXworks will tell you how to find them from Help -> Settings and resources.) So my first move was to create one new file, after first backing up the originals of course! I then did a few experiments, thinking about what I use a lot, what I’m used to, etc. I did wonder about some of the choices in the standard files, but a bit of experimentation suggests they are not so bad! So I’ve currently ended up mainly just adding a few things, for example

{tikzpicture}[#INS#]#RET#•#RET#\end{tikzpicture}•

for TikZ pictures and

cs:=\cs{#INS#}
pkg:=\pkg{#INS#}
\cs{#INS#}
\pkg{#INS#}

for package development work. I’m also not too keen on having too many of the ‘shortcut’ values, which don’t start \, so I’ve removed most of them and have just a core set (things like bf and em). If you want to see my current full set, you can of course download it.

So is there anything I’d like to see added to the way auto-complete works? I have a few ideas! From my questions on the TeXworks mailing list, I’ve picked up that TeXShop maintains indentation when doing auto-complete: TeXworks doesn’t, and I think it would be a good addition. TeXShop also allows an extended syntax

\documentclass[#INS#•#INS#]{•}#RET#
\rule[#INS#•‹lift›#INS#]{•‹width›}{•‹height›}

where you can always have a for ‘fill in’ and have ‘reminders’ about what the values are. That looks useful too.