LaTeX

Representing TeX.SX in TeX and LaTeX Contests

2012-06-15 by Stefan Kottwitz. 0 comments

Contests are a nice way of pursuing our TeX passion. We have an enjoyable competition, show our TeX skills and learn something new, while producing our contribution, and by seeing the results of other fellow TeXnicians. We already had a contest on TeX.SX, celebrating the first birthday of our site.

Contests are also a way to reach out to TeX users who did not visit our site yet: if such a contest happens somewhere else, and if we go there and show our skills.

Currently there’s one running on LaTeX-Community.org. LaTeX users are invited to write a small article, the best articles will be rewarded with a prize. Packt Publishing has sponsored two copies of the gnuplot Cookbook written by Lee Phillips for the winners. Matching the subject of the book, the topic of the contest is LaTeX and graphics.

The contest will close June 20th. So, there are some days left. Even small articles just like blog posts are very welcome. I would appreciate if some of our fellow TeX.SX users would join the competition. I know, we have very capable TeXnicians here on the site, also regarding the contest topic.

For more details about the competition and for a contact, have a look at the LaTeX Contest announcement.

The Hitch-Hiker’s Guide to LaTeX3

2012-05-23 by Andrew Stacey. 1 comments

Introduction

As with the original Hitch-Hiker’s Guide, this blog post won’t actually be all that useful to someone wanting to truly explore LaTeX3. It’s more of a “What I did on my holidays” kind of guide. I’ve recently had my first go at doing some coding with LaTeX3 and I thought it might be interesting to record my experiences.

The main site has certainly made me more aware of the LaTeX3 project. Familiarity, in this case, has not bred contempt but rather it has meant that LaTeX3 has seeped into my consciousness so that I’ve become vaguely familiar with it without ever actually having to think about it. Before this current experience then I had had a bit of exposure to LaTeX3 through making a few adaptations to the (most excellent) unicode-math package, but that was very definitely a case of “Monkey see, Monkey not really have a clue what he’s doing so it’s a million to one chance but it might just work.”. To really get to grips with something new, I need a problem to work on. Finally, along came a problem that I wanted to solve in TeX but which was very definitely a regular programming problem. So the prospect of doing it in ordinary TeX was too daunting to contemplate. For this problem, learning LaTeX3 seemed the lesser of two evils.

more »

KOMAscript: new English manual

2012-05-19 by keksdose. 0 comments

Markus Kohm, maintainer of KOMAscript has published a new version (3.11) of the KOMAscript bundle. There is one extraordinary issue: The new version includes a new manual in English. Markus said on his webpage:

»A new English user manual with the same structure and completely translated content of the German user manual is provided. There are still several issues with the translation, nevertheless, it’s much better than the previous English manual.«

As far as I can see, all the features of KOMAscript 3 are documented, the same as in the German version.

As TeXLive 2011 is frozen right now , you probably need to download the new version yourself from Berlios; follow the links on Markus’ website. Users of MiKTeX will probably get it soon.

Alexander

Using sprite sheets with LaTeX

2012-05-04 by Paulo Cereda. 4 comments

Sprite sheet is the name of a big image containing several smaller images or icons. It’s a technique usually employed by webdesigners to reduce the number of requests the browser makes to the server – reducing the number of HTTP requests can make a Web page load much faster. It’s also used a lot in animation engines.

I was wondering if I could use a sprite sheet in a LaTeX document, so I got a sample image from the Tango Desktop Project and mapped it:

All icons are placed in a big image, like a matrix, and the size is fixed at 24px × 24px per icon. How can I select one of the icons from a LaTeX document? Thanks to our friend and moderator Martin Scharrer, including sprite sheets is a breeze with adjustbox!

This amazing package, amongst other features, allows us to adjust images with \adjustimage. We can also use \includegraphics with the clip option which we can use for mapping our sprite sheet. For instance, let’s include the warning sign in our document. We need to collect some data first:

We have all the parameters for including the warning sign. It’s now a simple call to \includegraphics[clip,trim=48px 96px 120px 48px]{sampletango.png} or \adjustimage{Clip=48px 96px 120px 48px}{sampletango.png} and the correct icon is included! The parameters to the trim/Clip option are:

  • 2 icons from left to right: 2 × 24px = 48px
  • 4 icons from bottom to top: 4 × 24 = 96px
  • 5 icons from right to left: 5 × 24 = 120px
  • 2 icons from top to bottom: 2 × 24px = 48px

The full code is as follows:

\documentclass{article}

\usepackage{graphicx} \usepackage{adjustbox}

\begin{document}

\begin{figure} \centering % using includegraphics % \includegraphics[clip,trim=48px 96px 120px 48px]{sampletango.png} % using adjustimage \adjustimage{Clip=48px 96px 120px 48px}{sampletango.png} \caption{A warning sign.} \end{figure}

\end{document}

The output:

There we go, sprite sheets with LaTeX. :)

Generating LaTeX code with a template engine

2012-03-15 by Paulo Cereda. 7 comments

Sometimes, you get stuck with repetitive tasks, like generating the very same document over and over with a few changes in the content. I’m the coordinator of a small choir in a parish, and twice a month I have to print songsheets for the community. I usually try to automate as many tasks as I can, but LaTeX output is quite tricky. Here’s my attempt to write a program that spits out a .tex file.

more »

The cake is a lie

2012-01-30 by Paulo Cereda. 6 comments

It all started a few days ago, when we had a question on TeX.sx about using TeX for (nearly) any kind of document. In one of the answers, our friend Andrew Stacey mentioned that he even does his kids birthday invitations in TeX; in the comments, Stefan Kottwitz asked for seeing this TikZ birthday cake, so Andrew updated his answer with a picture of the cake:

Yummy! An epic TikZ cake.

We all got very excited by this elegant cake, so our friend N.N. posted a follow-up question on how can I draw a cake using TikZ; Andrew then posted his code, to the joy of the community!

We all love cake.

I know only a few things about TikZ, as I only use the automata library. But  I was tempted to draw another cake. And if you play games like I do, by the title of this blog post, you already know what kind of cake I’m talking about.

more »

Non-Standard Code – A Workaround

2011-12-11 by droratariah. 5 comments

Introduction

After answering the question about macro for \left( and \right) I realized that there’s a discussion worth considering behind the scene here. In particular, one can consider a beautiful solution, like the one of Herbert’s. This kind of answer, by all means, addresses the question posed. However, alongside, it also introduces several issues which might suggest that a better course of action is to be taken. Non standard code examples, like these which can be found in the question mention, as well as in many other threads in TeX.SE, have one prominent drawback, namely, they turn the code into a non standard one. I believe that for simple standard tasks (like the one dealt with in the question I started this post with) a more standard solution, in terms of TeX should be used. Let it either be code reuse or collaboration, non standard code serves as a problem. On the other hand, typing the full and standard TeX code can be sometimes be lengthy and tedious. Just like one won’t change the syntax of a for loop in any programming language, although it is being extensively used, one should not change, in my mind, the essence of TeX code. The alternative’s, which I would like to introduce and account my way of using, goal is to enable efficient typesetting process on the one hand, and maintain the resulting source code as standard as possible. It is called code snippets. more »

Building documents with rubber

2011-12-04 by Paulo Cereda. 12 comments

It’s common to compile our documents a couple of times to ensure, amongst other things, correct cross-referencing and indices. Sometimes, we also rely on a Makefile in order to make things easier. Now enters rubber, a powerful tool to help us on our building adventures.

more »

I TeX therefore iPad

2011-10-25 by Andrew Stacey. 14 comments

Intoduction

I have a new toy. It’s an iPad. Naturally the first thing that I tried to do was install TeXLive 2011 on it. When that didn’t work, I tried to take it back. When Apple disagreed with my reason (“Not able to run the best typesetting software”), I figured I’d just have to make the best of a bad job.

Actually, that’s a complete load of rubbish. The reason why it is rubbish is quite important to what I plan on writing here, so I’ll explain more below the fold. Above the fold, let me just explain what this article is. It is an account of my early days with the iPad with particular emphasis on anything vaguely relevant to my TeX addiction. If that interests you, read on.

more »

The TQFT Package

2011-10-10 by Andrew Stacey. 2 comments

Introduction

I’ve now uploaded the second of the TeX-SX packages to CTAN. This is the TQFT package and is a TikZ/PGF package for drawing TQFT diagrams. The original question was Topological Quantum Field Theory diagrams with pstricks or tikz.

more »