2

I have started going through all of the bookmarked answers on StackExchange that I want to use for examples. I have had success with most of the answers being able to compile within Overleaf. However, I tried importing the code from How do I get a tilted equal sign for an equation? and its answer into Overleaf. Specifically I tried to use:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\[\lim_{x\to0}\tikzmarknode{ex}{\mathrm{e}^x}\left(2+4x\right)~=~2\]
\begin{tikzpicture}[overlay,remember picture]
\path[red] ([xshift=1pt,yshift=1pt]ex.north east) -- ++(45:{width("=")*1pt-1pt})
node[midway,sloped]{$=$} node[above right=-2pt]{$1$};
\end{tikzpicture}
\end{document}

When I compile in Overleaf I receive the following two errors:

! Undefined control sequence.
l.6 \[\lim_{x\to0}\tikzmarknode{ex}{\mathrm{e}^x}\left(2+4x\right)~=~2\]
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


! Package pgf Error: No shape named ex is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.
...                                              

l.8 ...red] ([xshift=1pt,yshift=1pt]ex.north east)
                                              -- ++(45:{width("=")*1pt-...
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.

I believe that the second error (No shaped named ex is found) is due to the first error not creating the node.

2
  • Unfortunately I am having issues getting MikTeX to work on my school laptop to test out the same code using current libraries.
    – MrT_PHS
    Jun 21 '19 at 18:27
  • The version of tikzmark in Overleaf doesn't have \tikzmarknode. I even used this macro as a test to find out the version of tikzmark here. You can copy the code of tikzmark from CTAN and upload it to your project. Jun 21 '19 at 18:34
1

I think there is a test missing

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\[\lim_{x\to0}\tikzmarknode{ex}{\mathrm{e}^x}\left(2+4x\right)~=~2\]
\iftikzmark{ex}{\begin{tikzpicture}[overlay,remember picture]
\path[red] ([xshift=1pt,yshift=1pt]ex.north east) -- ++(45:{width("=")*1pt-1pt})
node[midway,sloped]{$=$} node[above right=-2pt]{$1$};
\end{tikzpicture}}{}
\end{document}
6
  • I just copied it into overleaf and I am still receiving the first error.
    – MrT_PHS
    Jun 21 '19 at 18:26
  • then the overleaf version is too old, on texlive 2019 it works with my change. Jun 21 '19 at 18:34
  • Once I get home I will test with textlive and accept the answer. Thanks.
    – MrT_PHS
    Jun 21 '19 at 19:04
  • Do you only get the error on the first compilation? (Or after deleting the aux file?) If so, this is a known bug which is fixed on github and just waiting for the lazy author to upload it to ctan. Jun 21 '19 at 22:20
  • @LoopSpace yes, that's my error. Jun 21 '19 at 22:23
0

Add these two files into your overleaf project, and it will work. I had the same problem and that worked it out.

1
  • Thanks Pedro. After getting it to work on my local install I added those files to Overleaf and was successful. I am trying to make templates and examples for my students to use when typing up their homework answers, I guess that I will have to put those files in our class Google Drive so that they can include them when using this technique.
    – MrT_PHS
    Jun 26 '19 at 14:57

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.