How can I detect which tikzmark version I'm using?

This is a pretty stupid check, but it works :)

According to CTAN, there were three versions of tikzmark, so probably no one (including Overleaf users) has a version other than these three.

These three versions were released on 2016, 2017, and 2018. Luckily I could have access to all three of them. Comparing the sources, I found macros which are/are not present in each version. The following macro checks the existence of these macros and prints the version date:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\makeatletter
\newcommand\tikzmarkversion{%
  \@ifundefined{tikzmark@inside}%
    {2016-04-09}%
    {%
      \@ifundefined{tikzmarknode}%
        {2017-06-02}%
        {2018-10-20}%
    }%
}
\makeatother

\begin{document}
    I have Ti\emph{k}Zmark version \tikzmarkversion

    Something with \tikzmarknode{A}{TikZ Mark}
    \begin{tikzpicture}[remember picture, overlay]
        \draw[<-, red] (A) -- ++(1,-1);
    \end{tikzpicture}
\end{document}

in my machine it prints:

enter image description here

and Overleaf reports: I have TikZmark version 2017-06-02.

The other versions complained about \tikzmarknode not existing, but the version date came out correct.


Update: I got the archived versions of tikzmark the frozen TeXLive versions back to 2013. The first appearance of tikzmark in TeXLive was in 2013. This release remained unchanged for 3 years. It was updated in TeXLive 2016 and was kept unchanged in TeXLive 2017. The third update was for TeXLive 2018. Thus a more fitting check is (until today, of course):

\makeatletter
\newcommand\tikzmarkversion{%
  \@ifundefined{tikzmark@inside}%
    {TL 2013--2015}%
    {%
      \@ifundefined{tikzmarknode}%
        {TL 2016--2017}%
        {TL >2018}%
    }%
}
\makeatother

Of course this shows only frozen versions of TeXLive. The package might have been updated twice in a single year, so a version in between might exist somewhere which was overwritten and did not live to the freeze. There might have been many un-annouced updates as moewe said, so it's hard to know for sure. However, I'd go for this second test because usually if one doesn't have the current TeXLive, their version is the frozen one, so this one is probably more certain than CTAN's announcements.

And Overleaf reports I have TikZmark version TL 2016–2017 in this one (which fits their claim of using TeXLive 2016 :).

I guess I'm a tikzmark historian now :)


Provided you have a local TeX installation, a simple look at the manual reveals the version. E.g. on my Mac all I have to do is to type

 texdoc tikzmark

on the console to find out that my machine is blessed (I really mean blessed here!) with v1.6 from 2018/10/18.

If you do not have a LaTeX installation since you are working with overleaf, say, I have no clue. However, I feel that there should be an answer to the question

How can one access the manuals of the version of a package that is used on overleaf?

yet it might be that the overleaf help center (and not this site) says more about this. At least I have nothing to say about this (and would like to argue that if some company bases its services on freely available packages, the very least this company should do is to make it easy for their users to get the information on the package version).


I recently had similar problem trying to find the Inkscape version used on Overleaf. Following this, I found the following approach:


First, you can use

\input|"texdoc -l tikzmark"

to get the texmf path, which already tells us a bit about the TeX Live version. Currently, Overleaf produces

/usr/local/texlive/2017/texmf-dist/doc/latex/tikzmark/tikzmark.pdf

so they are using some 2017 version of TeX Live.


At this point I wanted to just include (the first page of) the documentation via graphicx or pdfpages to include the manual into the document, but that didn't work. I also tried to copy the manual file to the project directory using cp with no luck. Trying to use inkscape (which can be used to convert .svg files to .pdf in Overleaf*) to do the same (using the -A or -e option) did not succeed either. Seems like the have their system secured against mischief of this sort..

* I don't know where the .pdf and .pdf_tex files are put when doing this (via the svg package). The user doesn't seem to have access to them. Having this information may reveal another route to do this in the right directory, where the permissions are different.


What we do have access to, however, is the tikzmark source code. We can just print it using

\verbatiminput{/usr/local/texlive/2017/texmf-dist/source/latex/tikzmark/tikzmark.dtx}

(or one of the listing packages). And, lo and behold, some pages down we find the version:

% \date{v1.3~from 2017/06/01}

As pointed out by Phelype Oleinik in the comments, we can use kpsewhich to directly obtain the path to the .dtx file:

\documentclass{article}

\usepackage{verbatim}
\usepackage{catchfile}

\begin{document}

\CatchFileDef\filepath{|"kpsewhich tikzmark.dtx"}{}
\verbatiminput{\filepath}

\end{document}