vi, emacs quick macros

vi

Some may be used to the magical “.” (period) command in vi, which magically repeats “the last thing you did”. Since this last thing can be quite complicated, this is some kind of easy macro in practice. Imagine you want to add a period at the end of every sentence of a list. Simple: type “A-<esc>” (i.e. A-hyphen-escape key) on the first sentence. Then go j.j.j.j.j.j.j. like mad. You can also type “4.” to do the thing 4 times (not very useful in this case).

emacs

But you know all this if you use vi anyway (why do you use it otherwise?). What I guess many people don’t know is that emacs also has quick macros. Type “C-x (” (i.e. control-x open parenthesis) and read the warning “defining keyboard macro”. “Keyboard” means this is not defined in some other way (e.g. in a config file). Now, type your macro. In the previous case you could type now C-a, “-“, down-arrow. Them “C-x )” to end your macro. Notice this includes the “down-arrow”, which moves to the next line (C-n is a more traditional way to do this). Type now C-e to execute the macro once. Type C-n C-x to do it several times (n is a number).

 

Advertisements

Bug de tabularx con acentos (LaTeX)

Hola,

Para mi sorpresa, tabularx, un entorno muy recomendable que extiende considerablemente tabular, se equivoca con el espaciado entre líneas cuando la primera letra está acentuada. He encontrado una manera de arreglarlo.

Continue reading

Cambiar nombres de secciones en LaTeX

Para cambiar el nombre de una sección, hay que cambiar el comando correspondiente, de una lista que puede encontrarse en el FAQ de TeX. Pero si se usa babel, hay que hacerlo después de \begin{document}, no antes (“preámbulo”). Lo elegante, para no olvidarse, es escribir en el preámbulo:

\usepackage[spanish]{babel}

\AtBeginDocument{%
\renewcommand\bibname{Referencias}%
}

El comando AtBeginDocument se encarga de ejecutar lo que queramos después de \begin{document}.

Continue reading

Fancy headers in LaTeX books

First in a series of notes on book formating under LaTeX. This is the header.tex file that defines the format for the headers and footers for each page. It’s pretty standard, as described in e.g. the Page Layout chapter of the wikibook on LaTeX. The only trick is taken from Mark Schenk’s page about his MSc Thesis: this piece of code makes empty pages (typically, the ones on even pages across the first pages of some chapters) completely and immaculately empty.

Continue reading

Readability

Readability: a very nice book bookmarklet (I didn’t know this word even existed) to improve readability of any given page.

Readability is a simple tool that makes reading on the Web more enjoyable by removing the clutter around what you’re reading. Follow the steps below to install Readability in your Web browser

Try it on online newpaper articles (not front pages!). Also great with manuals, blog pages…

Curriculum del Ministerio

Tres horribles palabras. Para cada convocatoria de cualquier proyecto se suele exigir en España un CV normalizado del Ministerio. (Bueno, son cuatro palabras.)

Una solución a la perspectiva de tener que actualizar a mano un documento (generalmente, con word) es la siguiente:

  • Utilizar el servicio de almacenamiento de CVs del Ministerio. Es un poco primitivo (intentar ordenar una lista larga puede ser frustrante), pero al menos es accesible desde cualquier sitio y cualquier convocatoria.
  • Ojo, hay campos opcionales que hay que rellenar: poner “0 investigadores” en un proyecto o da un error.
  • También está disponible en formae una versión offline en java de la herramienta.
  • Pedir una conversión a rtf. O, mejor, a LaTeX.
  • Corregirla:  ordenando listas de manera adecuada, borrando campos absurdos o vacíos (0 investigadores), poniendo bonita la parte de “Otros méritos” (con itemizes).
  • Compilar. El comando “\textbf{\hline}” que genera la apliación funciona, pero LaTeX se queja cada vez. Se puede sustituir por “\hbox to \textwidth{\hrulefill}”, que no da errores.

New LaTeX directions

Prompted by my friend Jan Hlavacek, I have compiled a list of recent and exciting developments in the TeX world. Good reads inculde

The list:

  • beamer (see post)
  • posters (see post)
  • XeTeX (see post)
  • LaTeX markup in wikipedia and google docs (see  post)
  • luatex, combining the lua language and TeX
  • pgf, a TeX macro package for generating graphics
  • The LaTeX3 project, a long-term research project to develop the next version of the LaTeX typesetting system (currently at LaTeX2e).
  • Support for BiBTeX in some journals (e.g., the APS, the AMS). And, on the WoK, which must be quite recent (I have just noticed).
  • mplib (Mmmh, couldn’t find anything about this…).

Update:

Prompted by Jan:

  • luatex has a (shortish) wikipedia entry.
  • MPLib is an extended MetaPost library module. There is some info at the luatex site, but a wikipedia entry has not been written (go write one yourself!). MetaPost does have an entry.
  • Very exciting developments in fonts (both related to luatex):
    • latin modern, “derived from the famous Computer Modern fonts designed by Donald E. Knuth
    • TeX gyre fonts, “an extensive remake and extension of the freely available 35 base PostScript fonts distributed with Ghostscript ver. 4.00”. (I love the word gyre, too. See ocean gyres.)
  • The Ipe drawing editor. Looks very nice – to tell the truth, I am still struggling with inkscape, which looks incredibly powerful.

And, some stuff I’ve discovered on my own:

  • BibTeX tools for microsoft word: Bibshare (made in Spain).
  • LaTeX markup in google docs (ok, I had another entry on this).
  • LaTeX typing in MathType.
  • LaTeX into power point: TexPoint and TeX4PPT.