2

I'm trying to do a clickable Bar plot that will give extra information once a bar is clicked.
I've seen some code examples using it and tried my own:

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{clickable}

\begin{tikzpicture}
\begin{axis}[
    ybar, bar width=3pt,width=14cm, height=7cm,
    xmin = 1960, xmax=2020, ymax = 250,
    ymajorgrids, ylabel={Count}, xlabel={Year},
    clickable coords= {Year \thisrow{year}:\thisrow{count}},
    xticklabel style = {rotate=90, anchor=east, align=center},
    xticklabel style = {/pgf/number format/1000 sep=},
    ticklabel style = {font=\footnotesize},]
    \addplot table[x=year,y=count] {
year    count
2019    246
2018    234
2017    197
2016    180
2015    181
2014    167
2013    145
2012    144
2011    124
2010    118
2009    103
2008    111
    };
\end{axis}
\end{tikzpicture}

But have not been able to compile them using overleaf:

    File: pgflibraryplotmarks.code.tex 2015/08/03 v3.0.1a (rcs-revision 1.14)
)))
(/usr/share/texlive/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clic
kable.code.tex

! LaTeX Error: File `insdljs.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 

l.145   \RequirePackage
                      [pdftex]{eforms}^^M
*** (cannot \read from terminal in nonstop modes)

Am I missing something?
Is this package obsolete? If so, is there an alternative?

Pedro
  • 474
  • 2
  • 10
  • 2
    Looks like you need to install insdljs.sty (and perhaps eforms.sty) manually, see https://tex.stackexchange.com/questions/340042/insdljs-tl-install-and-post-document-expiration-popup#comment834229_340042. One should perhaps also mention that your code fragment won't work regardless of these complications. –  Apr 22 '20 at 22:46

1 Answers1

4

Some of the dependencies of the clickable library are not included in TeX Live because of licensing restrictions. You can see this at the package's CTAN page: notice that it's part of the acrotex bundle, and only listed as included in MikTeX, not TeX Live.

Overleaf uses TeX Live, so if you want to use the clickable library on Overleaf, you'll need to manually add the insdljs package and some of its dependencies to your project. This involves downloading the package sources from CTAN and processing the .ins files with latex to generate the required .sty and other files. This is possible with Overleaf, but not entirely trivial.


If you have a TeX distribution installed on your own computer, you can get the required files from it. This will be easier than generating them on Overleaf. If you happen to have MikTeX installed, acrotex will be available on your system (assuming you've installed the package). So you can copy the required package files and add them to your Overleaf project.

If you have TeX Live installed on your system, you can download the package's source files from https://ctan.org/pkg/insdljs, extract the archive, then run the following from the extracted directory:

latex insdljs.ins
latex eforms.ins
latex taborder.ins

Then take all the files generated by running those commands and upload them to your Overleaf project. If you'd like, you can hide these files in a subfolder inside your Overleaf project using the approach described at How can I keep a clean document folder with custom .cls, .sty, .bst files in a separate subfolder?


If you don't have your own TeX distribution installed on your PC, and thus need to do this process on Overleaf: It can be done, but it's admittedly a bit convoluted. :-)

This process only needs to be done once. Once you have the .sty and .def files resulting from this process in an Overleaf project, you don't need to repeat this, you can simply copy the Overleaf project to get a new project with the required files included.

  1. From The AcroTEX education bundle, download these files and upload them to a temporary Overleaf project:

    insdljs.ins
    insdljs.dtx
    eforms.ins
    eforms.dtx
    taborder.ins
    taborder.dtx
    
  2. Create a new file in the root directory of your temporary Overleaf project called latexmkrc (with no extension) containing this line of code:

    BEGIN {system ('latex insdljs.ins; latex eforms.ins; latex taborder.ins');}
    

    This will instruct Overleaf's build tool (latexmk) to process these .ins files the next time you compile.

  3. Recompile the project. This will produce a number of extra files: the insdljs.sty file and its dependencies.

  4. Download all these extra files. You can find the required files in Overleaf's output files area. You only need to download the output files that have a .def or .sty extension.

  5. Upload these .sty and .def files to the Overleaf project where you want to use the clickable library. As I mentioned above, you may want to place these in a subfolder and set up a latexmkrc file so the compiler finds them: How can I keep a clean document folder with custom .cls, .sty, .bst files in a separate subfolder?

  6. Once you have downloaded the .sty and .def files, you're free to delete the temporary Overleaf project used to create them.

Paul Gessler
  • 29,607