2

I was using the annotate-equations package https://github.com/st--/annotate-equations to create annotated equations.

The position of annotations seems to be wrong while rendering it in LaTeXit. enter image description here

The same code works well in normal LaTeX editor: enter image description here

By looking into the .sty file of that package, I assume the problem comes from anchors (north, west, etc.) in TiKz package, but I failed to solve this problem.

In the running log, there is a warning about labels: enter image description here

The code I used is below:

Preamble:

\documentclass{article}
\usepackage[usenames]{color} %used for font color
\usepackage[dvipsnames]{xcolor}
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{annotate-equations}

Main:

\begin{equation*}
  \eqnmark[purple]{node1}{GEBV}
  \tikzmarknode{node2}{=}
  \eqnmark[black]{node3}{\sum_{i}^{n}}
  \eqnmarkbox[blue]{node4}{X_{i}}
  \eqnmarkbox[red]{node5}{b_{i}}
\end{equation*}
\annotate[yshift=1em]{left}{node3}{sum across n loci} 
\annotate[yshift=-1em]{below,left}{node1}{Genomic Estimated Breeding Value} 
\annotate[yshift=-1em]{below,right}{node5}{effect at locus i} 
\annotate[yshift=-2.5em]{below,right}{node4}{genotype at locus i}
1

1 Answer 1

3

The problem arises because annotate-equations is using the TikZ remember picture key, which requires two runs of LaTeX to work. If you try your code in a regular editor that doesn't use an automated build process like latexmk by default, you will see exactly the same output as your LaTeXit output after the first run. So there's no problem with the package at all.

In order to get multiple runs to work with LaTeXit, you need to implement a middle processing script in the settings. I'll walk you through the steps of this.

In the LaTeXit settings, choose the Typesetting Panel and choose Edit the configurations from the Configurations dropdown menu in the panel:

new configuration

Give it a sensible name (I've chosen extrapdflatex) and then click on the Additional Scripts button right below.

From that panel, click on the Middle Processing checkbox so that it is selected, and then choose Define a Script and enter pdflatex $INPUTTEXFILE in the script box:

additional script

Now if you compile your example document with the new configuration, you should get the output you expect.

output of code

1
  • It works, thank you!
    – Checco LI
    Commented Apr 8 at 1:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .