LaTeX: footnotes in tables

Although an apparently widely known LaTeX issue, I came across it just today. Fact is if you use \footnote inside a \tabular environment, the footnote will be “trapped” inside the table, and actually never get displayed at all in the output.

You can find some possible solutions for that at the UK TeX FAQ on the Web.

The trick I’ll comment here is to use \tabularx, which is covered in the link above, and also at J.L. Diaz’s LaTeX blog[es].

The “problem” is that \tabularx requires a fixed table width value to be input by the user, so the following will fail misserably:

\usepackage{tabularx} % required in the preamble
\begin{tabularx}{100mm}{|c|c|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

Why? Because the {c} especification (to center the text inside the cell) makes the affected column as wide as necessary, not more (so will {r} or {l}). The output can be seen below:

The effect of the whole table being actually wider than the sum of the integrating colums could be partially “concealed” if the \hlines were eliminated, but the table would still be actually incorrectly wide, which would make things like aligning the whole table “fail” (to the eye).

Fortunately, the tabularx package provides a way to tell LaTeX that a column must be of the necessary width, so that the sum of colum widths equals the total column width. This is the {X} keyword (notice the capitalization of the “X”). E.g.:

\begin{tabularx}{100mm}{|c|X|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

This makes the first column just as wide as needed, not more (the {c}), and then, the second column will be as wide as needed to reach the 100mm. The output:

If multiple columns are given the {X} keyword, they will all have the same width, precisely the one required to meet the total table width.

Comments (3)

Sudaku released

I previously posted about the sudoku fever that had attacked my family. I have found amusing solving some sudokus, but what I really thought was interesting was making a computer program to solve them automatically. Not that it would be more “challenging” (some sudokus are quite difficult), just more fun for me.

OK, so that I did, and today I have released a Perl program that (hopefully) solves any sudoku we feed to it. The program is called Sudaku (well, one sweats when solves a sudoku, doesn’t one?), and can be freely downloaded from my home page. I have licensed it under the GPLv2.

Yes, I know there are other sudoku solvers around, probably better than mine, on top of that. However, I just wanted to make it, and releasing it may help someone, or (more probably) even me, if some better programers than me out there e-mail me proposing changes/corrections.

What the heck, I just felt like releasing it! :^)

Comments

Pirates of the Caribbean II

Yesterday I watched Pirates of the Caribbean: Dead Man’s Chest, as it was a must-see for me, after the first part, which I liked very much.

I have to say I liked it much (my critic[es] at FilmAffinity), but it lacks originality (this was to be expected). The special effects are superb, and the setting, the script, the costumes and acting all join together to make the story believable (meaning that just the fights and chases are incredible, not the development of the events) and easygoing. Ten points for that.

However, the movie is little more than a clone on steroids of its predecessor Pirates of the Caribbean: The Curse of the Black Pearl: it repeats the “success recipe” of the first part shamelessly. Bad boy, Gore Verbinski!

All in all, very funny and a good pastime, but not as good as the first one.

Comments

Back from my holidays

I’m back to work (and blogging) from a three-week holiday period in Valencia.

I have a couple of things to blog about. I’ll blog them, then try to hack the entries to pretend they were blogged the day I would have blogged them, were I not AFK :^)

UPDATE: silly me, posts can be given any date. It’s not even a “trick”. It’s just an everyday feature.

Comments

Salvaje agresión a inocente periodista

Hoy, zapeando, he tenido ocasión de ver uno de los (ejem) magníficos reportajes de denuncia social de un programa de telebasura y prensa rosa (creo que era “Aquí hay tomate”, pero podría haber sido cualquier otro). Paso a relatar los hechos que se exponían:

Una famosa X (quizá era una de las acusadas por corrupción en Marbella, no lo sé, ni me importa) huía de un grupo de “honrados” paparazzi que la acosaban por la calle. Aparentemente había un corrillo de gente, que en estos casos siempre acuden, como moscas a la mierda.

Eventualmente, X llegó a su vehículo (un todoterreno), abrió la puerta y entró… seguida por el insidioso brazo de una reportera, que sostenía un micrófono que intentaba meter bajo la boca de X, incluso cuando esta ya había entrado en el vehículo. Llegado este punto, X cerró la puerta tras ella, sin mirar atrás (y con bastante mala leche), golpeando el brazo de la reportera, quien lógicamente se apartó, doliéndose amargamente del brazo. X simplemente arrancó y se fue.

Hasta aquí los hechos (que estaban todos grabados y bien grabados en vídeo, lógicamente).

Lo que me parece notable de esta pseudonoticia es que los pseudoperiodistas del deleznable teleshow ¡¡¡tuvieron las agallas de poner a parir a X, por pillar el brazo a la reportera!!!

Estas preclaras mentes se dedicaron a repetir el vídeo a cámara lenta (solo el momento del portazo, claro, no todo el tiempo que estuvieron acosando a X), intentando “demostrar” que X cerraba la puerta con la malvada intención de pillar el brazo a la reportera, y que no fue un accidente (en esto estoy razonablemente de acuerdo con ellos), y a denostar a X, primero por la agresión, y segundo por la denegación de auxilio a la periodista magullada.

¿Denegación de auxilio? ¿Es que acaso la periodista no tenía compañeros que la ayudaran? Por ejemplo el propio cámara, a quien no tembló el pulso en ningún momento, y siguió filmando sin parpadear, supongo que pensando para sí “¡Wow! ¡Menudo reportaje que me va a salir!, en vez de considerar el dejar la cámara y asistir a su compañera herida. Por no mencionar a toda la gente que tan valientemente seguía y apoyaba el acoso a X cuando caminaba por la calle, pero en cambio silbaba y miraba para otro lado cuando había una mujer herida que necesitaba ayuda. Me pregunto cuántos perdieron el culo llamando a una ambulancia, o se ofrecieron a trasladarla a un ambulatorio en su coche.

No puede haber denegación de auxilio cuando se deja “bien acompañado” al accidentado. Claro que, en este caso, con las víboras de sus ¿compañeros? reporteros y las ¿respetables? gentes de la calle… igual es cierto que no estaba “bien acompañada”.

Por otro lado, ¿qué importancia tiene la discusión de si X cerró la puerta de buena o mala fe? Aquí todos a poner a caer de un burro a X por cerrar la puerta de SU coche, para ejercer su DERECHO a largarse, pero nadie considera la injustificada lesión de los derechos de X que hizo la reportera al meter la mano en SU coche, e intentar impedirle con ello que se fuera.

Yo lo tengo muy claro: si metes la mano en el cortacesped, te expones a que te la corte. No es culpa del cortacesped, sino tuya, por gilipollas. Y en este caso, la reportera fue malintencionada, además de gilipollas. Una cosa es que te aborden por la calle, y más o menos te tengas que aguantar. Pero que se inmiscuyan DENTRO de tu PROPIEDAD PRIVADA es algo que no tienes por qué tolerar. Meter la mano dentro de tu coche es como que metan la mano por la ventana de tu casa para grabarte mientras lees el periódico en la sala. Si tienes un bate de beisbol a mano le metes una buena, por entrometido. Y encima le denuncias TÚ a ÉL por acoso.

Los (*-Mamá, ¿se puede decir “hijoputa” en un blog?. -No, hijo. -Vaaale.*) hipócritas de pseudoperiodistas encima decían que dar un portazo no eran maneras, que X tenía que haber pedido por favor a la reportera que quitara el brazo. ¡Sí, hombre! Claro, como la reportera no sabía que estaba tocando las narices a X, esta tenía que hacerselo saber. Claro, como no llevaban media hora hostigándola, como que alguien a quien rehuyes te meta el micrófono bajo las narices no es considerado molesto por nadie, como meter el brazo en el coche de alguien aprovechando que entra en él nadie lo considera agresivo… pues claro, X tenía que hacer saber a la reportera (de buenas maneras, por descontado) que la estaba molestando, y pedirle (por favor, of course) que retrajera su extremidad superior derecha del vano de la puerta de su automóvil… ¡Anda ya!

Tal como lo entiendo, la reportera (envalentonada por la débil defensa del derecho a la privacidad y protección frente a acosos que hay en este país de charanga y pandereta) agredió continuadamente a X, culminando dicha agresión en la violación de su espacio privado (el interior de su propio coche). Dichas agresiones tuvieron consecuencias negativas para la agresora (dejemos los roles claros: en esas circunstancias X era víctima de acoso, y la reportera la acosadora). Pues mala suerte. Para la próxima que se replantee qué derechos está dispuesta a pisotear y qué riesgos está dispuesta a correr en el el ejercicio de su profesión. A los reporteros que no meten el brazo donde no deben nadie se lo pilla con una puerta.

Comments

Photos to paper

Today I walked by a photograph development shop, and was struck by an ad they had showing:

Watch out for viruses! Put your digital photos to on paper, lest you lose them to computer failures.

Now, with the advance in popularity of digital photography, it is evident that development shops need to find (or invent) new incentives for attracting fleeing customers, who make do with watching their pics on the computer screen.

However, I think they miss the shot here (see the pun?), and for two reasons:

Paper is a bad format

Hard disks can fail, and digital contents (e.g. pictures), can be lost. However, putting them on paper is hardly a solution. The convenience, comfort and flexibility given by a digital format can not be matched by a paper copy. What if I want to manipulate a picture (say, with the GIMP)? What if I want to send a copy to a friend by e-mail? What if I want to make an arbitrary number of copies for free and with no quality loss?

One could argue that paper is indeed good in some cases, e.g. if we want to be able to watch the pics without turning the computer on. But then, those reasons should be called upon to suport the development shops, not the backup excuse!

Viruses don’t ruin digital content

OK, this is not completely true. With MS Windows, viruses can damage the contents of your hard disk. However, that poor excuse of an OS is hardly the only OS out there, and most others (all others?) are impervious to viruses. Taking care of potential (eventual?) errors in that lame plataform is like putting an airbag in your car because it doesn’t have brakes. Well, yes, the airbag is great (and would be a great improvement, even in a car with brakes), but who in her right mind would drive a car without brakes in first place, for god’s sake!?

Anyway, as mentioned above, hard disks do fail, regardless of the OS they run under, so some backup is highly desirable, that’s true. It just turns out that paper is not suitable for such a task.

The way to go is, obviously, backing up your photos (or whatever) into other digital media, such as another hard disk, a CD, a DVD, etc. No virus or critical error of my stupid OS can delete the photos in a CD sitting on a shelf. The CD can wear out and fail, but it would be too big a coincidence to have it happen the same day your hard disk is also damaged by your (if you use Windows) or your computer’s (if the HD wears out) error.

And if you are paranoid, just make TWO CD backups.

Comments

Sudoku fever

I had resisted the social pressure to start making Sudokus until this August. I just didn’t want to make them “because they are fashionable”.

However, I have finally succumbed, and tried them. I have to say that (unlike my parents, who are hooked), I found them mildly amusing. Yes, they are entertaining, and yes, they can be quite difficult sometimes. I can not say that they bore me because they are too easy, or desperate me because they are too difficult. I enjoy them, just I don’t go crazy over them.

An anecdote about the matter is that one day my father and I went to a newsagent’s looking for a booklet of Sudokus, but found none in the pastimes section. We were puzzled, because Sudokus are such a hit, and a newsagent’s not selling them made no sense. We asked the seller, and she pointed to another section: the Sudoku section. They had devoted a whole section to them! Now, that made sense :^)

Comments

GoDaddy… sucks?

The only information I previously had about the web hosting company GoDaddy was that they massively changed some “parked” domains from GNU/Linux to MS Windows machines (see new in Netcraft.com and Menéame[es]). “Parked” domains are URLs that have owner, but no content (e.g. they have been “reserved” for future use). As such, they do not need any security or high performance, so switching from Linux/Apache to Windows/IIS was meaningless. The objective of this movement was just propagandistic: most likely MS bribed them to switch, so that they could say: “Hey, IIS has 3.5M more web pages, and Apache 3.5M less! It shows that IIS is gaining market!”. Pathetic.

However, bad news from GoDaddy are far from over. I just read at Javi Moya’s blog[es], the lack of professionality of its tech support[es].

It seems that not only customers are angry: some ex-employees are, also. One even made a web page to comment how much GoDaddy sucks.

Comments

Why use LaTeX

Somehow (don’t remember exactly) I came across this LaTeX advocacy page, in which some reasons are given as to why use the typesetting software the reader must already know I use and love: LaTeX.

Comments

Some numbers on FLOSS

Looking at the Free Software page in the Wikipedia (to which I have contributed with the “However, direct economic benefit is hardly the main reason[…]” paragraph), I found the following link.

Although it’s about 9 months old, it is still meaningfull, and makes for a good reading. Also check this Groklaw article.

Go ahead and “get the facts”.

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »