Texinfo: Writing Plain Spanish

After a few weeks of researching we finally decided for Texinfo as our technical writing platform of choice. But before we did the switch, there was a serious complain about Texinfo: The inability to write plain spanish!!!

For us results really odd to write @’a for an a with accent, we still prefer á. So we found a workaround from Vladimir Támara (http://www.geocities.com/sl_edu_colombia/soluciones/vladimir/linux_esp.html), that used sed to replace all accents in our original texi file.

So here’s the howto:

Step 1

Create a file called encodetexi.sh (or name it whatever makes sense for you), and put the following bash code in it:

#!/bin/bash
sed -f <b>encondetexi.sed</b> $1 &gt; tex/$1

This script will encode your accents to the formal Texinfo way with sed, and put them in the subdirectory tex/ (don’t forget to create it or change the script to handle the new subdir creation).

Once created give execute permitions to the script:

chmod 775 encodetexi.sh

Step 2

Create a file named encodetexi.sed which contains the substitution patterns for sed. Here is the content of the file:

s/á/@'a/g
s/Á/@'A/g
s/é/@'e/g
s/É/@'E/g
s/í/@'{@dotless{i}}/g
s/Í/@'I/g
s/ó/@'o/g
s/Ó/@'O/g
s/ú/@'u/g
s/Ú/@'U/g
s/ñ/@~n/g
s/Ñ/@~N/g
s/ü/@\"u/g
s/Ü/@\"U/g

This will replace all accents, tildes, etc. from our original texi file and create a well encoded file in tex/ subdir.

Step 3

Now plunge your texi files in plain spanish, use accents and tildes at will.

Step 4

Run the script (again, make sure you got tex/ subdir):

$ encodetexi.sh your_file.texi

Final thought

Funny… after revisiting this post it would make much more sense to be written in spanish :|

Texinfo: Writing Plain Spanish