25 de junio de 2020

Equations system with a black rectangle in LaTeX

A friend sent me a file in LaTeX that she had received. When compiling it, one of the equations had a strange black rectangle:
The file was about 20 pages long. After minimizing and minimizing the file, I got this simplified version:

\documentclass[12pt]{article}

\usepackage[table]{xcolor}



\begin{document}

\centering


Some initial text.



\[

  \begin{array}{c}

    \rowcolor{red}

      1 + 2 = 3 \\

    \rowcolor{green}

      1 + 2 = 3 \\

    \rowcolor{blue}

  \end{array}

\]




Some random two pages of text here \\

just to make debugging difficult.



\[

  \left\{

    \begin{array}{rrrrrrr}

       2x &+& y &+& 4z &=& 0\\

        x &+& 6y &+& 7z &=& 0\\

    \end{array}

  \right.

\]



Some final text.



\end{document}


Can you spot the error? In case you can't mentally compile LaTeX, the result is:

Now, is it easier to find the error?

[spoiler alert]

Well, the problem is in the previous table, it has the declaration of the color of the “last” row that does not exist. In the original version, it was a commented row, making it more difficult to spot. Moreover, between one table and the equations system there were one or two pages, making it more difficult to see that the error was actually caused by something that was much earlier than the position where it appeared.
\[

  \begin{array}{c}

    \rowcolor{red}

      1 + 2 = 3 \\

    \rowcolor{green}

      1 + 2 = 3 \\

    \rowcolor{blue}    % <---- the error is here

  \end{array}

\]



The strangest thing is that you get a black rectangle instead of a blue rectangle. I suppose some flag is set that says that there is something interesting in the next cell, but  the color is reset and that is why it is black. I've been looking at the xcolor package code, but my LaTeX-Fu is not strong enough. (It is not even clear to me if this is classified as a bug or not.) And furthermore, there is a workaround that is not to write LaTex with errors.


Bonus: The error is in the first part, so with a trivial change in the second part we can get a matrix or table with a strange black cell.
\begin{center}

  \begin{tabular}{|c|c| c|}

     \hline

      a  &  b  &  c  \\

     \hline

     $1$ & $2$ & $3$ \\

     \hline

  \end{tabular}

\end{center}

Sistema de ecuaciones con un rectángulo negro en LaTeX

Una amiga me pasó un archivo en LaTeX que había recibido. Al compilarlo una de las ecuaciones tenía un extraño rectángulo negro:
El archivo tenía unas 20 páginas. Después de minimizar y minimizar el archivo, llegué a esta versión simplificada:
\documentclass[12pt]{article}

\usepackage[table]{xcolor}



\begin{document}

\centering


Some initial text.



\[

  \begin{array}{c}

    \rowcolor{red}

      1 + 2 = 3 \\

    \rowcolor{green}

      1 + 2 = 3 \\

    \rowcolor{blue}

  \end{array}

\]




Some random two pages of text here \\

just to make debugging difficult.



\[

  \left\{

    \begin{array}{rrrrrrr}

       2x &+& y &+& 4z &=& 0\\

        x &+& 6y &+& 7z &=& 0\\

    \end{array}

  \right.

\]



Some final text.



\end{document}


¿Podés encontrar el error? Por si no podés compilar LaTeX mentalmente, el resultado es:
¿Ahora es más fácil encontrar el error?

[spoiler alert]

Bueno, el problema está en la tabla anterior, tiene declarado el color de la “última” fila que no existe. En la versión original, era una fila comentada, lo que hacía que sea más difícil notarla. Es más, entre una tabla y el sistema de ecuaciones había una o dos páginas, por lo que era más difícil ver que el error en realidad era causado por algo que estaba mucho antes de la posición en la que se veía
\[

  \begin{array}{c}

    \rowcolor{red}

      1 + 2 = 3 \\

    \rowcolor{green}

      1 + 2 = 3 \\

    \rowcolor{blue}    % <---- the error is here

  \end{array}

\]



Lo más extraño es que aparece un rectángulo negro en vez de un rectángulo azul. Supongo que queda seteado un flag de que hay algo interesante en la próxima celda, pero el color se resetea y por eso es negro. Estuve viendo el código del paquete xcolor, pero mi LaTeX-Fu no es lo suficientemente fuerte. (Ni siquiera me queda claro si esto se clasifica como un bug o no.) Y además hay una solución que es no escribir LaTex con errores.


Bonus: El error está en la primera parte, así que con un cambio trivial en la segunda parte podemos obtener una matriz o una tabla con una extraña celda negra.
\begin{center}

  \begin{tabular}{|c|c| c|}

     \hline

      a  &  b  &  c  \\

     \hline

     $1$ & $2$ & $3$ \\

     \hline

  \end{tabular}

\end{center}

30 de abril de 2020

Coquitos for quarantine

We are still in quarantine, but we had a bit of grated coconut and we made coquitos:
  • 200g grated coconut
  • 200g sugar
  • 2 eggs
  • I have no idea how hot the oven was.
We shaped them by hand, so they got with some very nice burnt stripes on the sides.

Coquitos: Some are already missing in the photo

(We tried a second time, but the mixture was very dry and after cooking they crumbled. It is very strange. Maybe it depends on the humidity of the grated coconut?)

30 de marzo de 2020

About the AR$5 bill in Argentina

[Quarantined]

[I should have written this a month ago, because with the Covid-19 quarantine the situation changed a lot, and most of this doesn't make sense now. Anyways, this seems to be a story that deserves to be told and I have some free time.] [We are fine for now. Thanks for asking.]

Once upon a time, during February ...

The effective exchange rate of the (US) dollar is approximately AR$80, so according to the estimate in the article on the AR$1 coin, the AR$2 coin should fall into disuse. (Surprisingly, it took less time than expected.)
This is not a strict rule, but it is a custom in Argentina. Recently (January-February), I was already seeing that we started to round the prices to pay to a multiple of AR$5. For example, if we must be pay AR$102, it was likely that no one would demand the AR$2 coin.


We had AR$5 bills and AR$5 coins in circulation, but the bills were old and they recently were taken out of circulation. They can be exchanged in a bank, but they cannot be used in a business.


The problem is that the amount of coins of AR$5 is approximately 1/4 or 1/5 of the amount of bills! So, when the AR$5 bills stop circulating, nobody had enough AR$5 coins.

If there are no coins ...

The solution is then to use the AR$2 coins and even rummage through the drawers and dust off the AR$1 coins that had already practically fallen into disuse. I think I have seen more coins of AR$1 in the last days (February) than in the last months. In general, when paying the coins are combined to form a multiple of AR$5 because many of the prices of discrete products are already rounded. (Although there are exceptions such as candies that are worth AR$3 and are a problem.)


My proposal (in February) is to stick with Superglue two coins of AR$2 and one coin of AR$1 and get a combo of AR$5. It would be much easier than searching and choosing the coins one by one (although perhaps illegal). However, after a few days, surely someone will replace the middle coin with a fake one to obtain a 40% profit.

[Current situation]

[Due to the current situation, we are trying to do only one or two weekly purchases at the supermarket. It is a large purchase and we pay with a credit card, so nobody cares if there are coins or not.]