Trevor
I have a Latex document, inside of which I have figures written in Metapost (included using the `luamplib` package). I would like to include references to parts of the Latex document (e.g., sections) within the Metapost code. I have tried to do this, but unfortunately the links positions end up either not matching the text position, or the links are not created at all.
Here is a minimal working example (compiled with `lualatex`).
```
\documentclass[10pt]{article}
\usepackage{hyperref}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\begin{document}
\section{My section} \label{sec:my_section}
Hi
\begin{mplibcode}
beginfig(1);
label(btex \ref{sec:my_section} etex, (14,6)); % this creates a link in the wrong location
label(btex \ref{sec:my_section} etex, (39,6)); % this does not create a link at all
endfig;
\end{mplibcode}
\end{document}
```
An snippet image of the resulting document is shown below. The first `label()` command creates a "1" (the leftmost "1") and a link (the red box), but the positions don't match. The second `label()` command creates a "1" (the rightmost "1"), but does not create a link at all.
