2

I have exported my curve from matplotlib using the following guide. But there is a problem with reference at y-axis label. You can see it on screenshot: enter image description here

The red square should be at "1" in "(s. 1)". I did it with \ref{...} and included the hyperref library. The label will be initiated with the following line in pgf file:

\pgftext[x=0.469752in,y=2.376000in,,bottom,rotate=90.000000]{\color{textcolor}\rmfamily\fontsize{10.000000}{12.000000}\selectfont Energiedichte \LaTeX \(\displaystyle \varphi\) (s. \ref{formel:wichtig}) [Js]}%

It seems that \ref (and even \hyperref) annotation doesn't use rotate parameter. Is it some kind of bug in it? What can be a possible way of soltion this problem?

  • Thanks for your reply @JohnKormylo. There is no axis environment. I have shared the related code to pastebin link – Leonid Lunin May 12 '20 at 13:21
2

It does look like a problem specific to \pgftext. You can fix it by using \rotatebox instead.

\documentclass{article}
\usepackage{tikz}
\usepackage{hyperref}
\begin{document}
\refstepcounter{figure}\label{formel:wichtig}
\hrule
\begin{tikzpicture}
\pgftext[x=0.469752in,y=2.376000in]{\rotatebox{90}{\color{black}\rmfamily\fontsize{10.000000}{12.000000}\selectfont Energiedichte \LaTeX \(\displaystyle \varphi\) (s. \ref{formel:wichtig}) [Js]}}%
\end{tikzpicture}
\end{document}
  • That helps! But now the label overlapped the axis screenshot. I understand that this can be fixed with chaning of x coordinate, but how can I calculate the difference of them and where does the problem come from? – Leonid Lunin May 12 '20 at 14:08
  • \rotatebox can adjust the center of rotation. The default is. [origin=bl] or [origin=Bl] so [origin=c] or [origin=cb] should do it. Documentation is from the graphicx manual. – John Kormylo May 12 '20 at 14:23
  • That's true, but doesn't help. Seems like anchorpoint should be right on edge of the box, otherwise it's still the same... – Leonid Lunin May 12 '20 at 14:24
  • Thank you so much for your help. If I am ready to contribute code base can you explain, where the problem occures? In hyperref or basically in ref? – Leonid Lunin May 12 '20 at 21:11
  • You can put a \ref inside a savebox and rotate the savebox, no problem. The weirdness comes from \pgftext. – John Kormylo May 12 '20 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.