ReScience / ReScience

The ReScience journal. Reproducible Science is Good. Replicated Science is better.
https://rescience.github.io
698 stars 36 forks source link

Makefile returns "pandoc-crossref: Error in $: mempty" #56

Closed alexdiem closed 7 years ago

alexdiem commented 7 years ago

Hi, the Makefile for creating a tex file from the md manuscript returns the following errors: pandoc-crossref: Error in $: mempty pandoc: Error running filter /home/alexandra/.cabal/bin/pandoc-crossref Filter returned error status 1 Makefile:10: recipe for target 'rescience-template.tex' failed make: *** [rescience-template.tex] Error 83 Does anyone know what needs to be done to resolve this? Thanks! Edit: I have tried completely removing pandoc and pandoc-crossref and reinstalling them.

rougier commented 7 years ago

Not sure. Can you try to strip text from your md file such as to keep only the refs and check if it compile properly ?

alexdiem commented 7 years ago

I've stripped it down to just one reference to a figure, but the error is the exact same.


![Caption](figures/fig1.png){#fig:fig1}

@fig:fig1```
rougier commented 7 years ago

Can you check if you can compile the demo.md example given on crossref page ?:

$ pandoc -F pandoc-crossref -F pandoc-citeproc demo.md -o demo.html
pandoc-citeproc: reference unprocessedCitation not found
alexdiem commented 7 years ago

Interesting, if I try to run that I get

pandoc: Filter pandoc-crossref not found

even though

cabal install pandoc-crossref

returns

Resolving dependencies...
All the requested packages are already installed:
pandoc-crossref-0.2.5.0
Use --reinstall if you want to reinstall anyway.
rougier commented 7 years ago

What information do you get from cabal info pandoc-crossref?

alexdiem commented 7 years ago
* pandoc-crossref  (program and library)
    Synopsis:      Pandoc filter for cross-references
    Versions available: (0.1.5.6), (0.1.6.3), (0.1.6.4), 0.1.6.5, 0.2.2.1,
                        0.2.3.0, 0.2.4.1, 0.2.4.2, 0.2.5.0 (and 24 others)
    Versions installed: 0.2.5.0
    Homepage:      [ Not specified ]
    Bug reports:   [ Not specified ]
    Description:   pandoc-crossref is a pandoc filter for numbering figures,
                   equations, tables and cross-references to them.
    Category:      Text
    License:       GPL-2
    Author:        Nikolay Yakimov
    Maintainer:    root@livid.pp.ru
    Source repo:   https://github.com/lierdakil/pandoc-crossref
    Executables:   pandoc-crossref
    Dependencies:  base >=4.8 && <5, pandoc >=1.17.1 && <1.20,
                   pandoc-types >=1.16 && <1.18, mtl >=1.1 && <2.3,
                   containers >=0.1 && <0.6, data-default >=0.4 && <0.8,
                   data-accessor >=0.2.2.6 && <0.3.0.0,
                   data-accessor-template >=0.2.1.12 && <0.3.0.0,
                   data-accessor-transformers >=0.2.1.6 && <0.3.0.0,
                   template-haskell >=2.7.0.0 && <3.0.0.0,
                   roman-numerals ==0.5.*, syb >=0.4 && <0.7,
                   utility-ht >=0.0.11 && <0.1.0, directory >=1 && <1.4,
                   filepath >=1.1 && <1.5, pandoc-types -any, pandoc -any,
                   pandoc-crossref -any, base >=4.8 && <5, pandoc-crossref -any,
                   directory -any, filepath -any, pandoc -any, hspec -any,
                   base >=4.8 && <5, data-accessor-transformers -any,
                   filepath -any, directory -any, data-accessor -any,
                   utility-ht -any, template-haskell -any, roman-numerals -any,
                   syb -any, data-accessor-template -any, data-default -any,
                   containers -any, mtl -any, pandoc-types -any, pandoc -any,
                   hspec -any, pandoc-crossref -any, base >=4.8 && <5
    Documentation: [ Not installed ]
    Cached:        Yes
    Modules:
        Text.Pandoc.CrossRef
rougier commented 7 years ago

What about pandoc -v?

rougier commented 7 years ago

On my machine (OSX), pandoc-crossref is reported as not installed but it is actually installed (via homebrew) in ~/.cabal/bin/pandoc-crossref

alexdiem commented 7 years ago

Ah, there is the root of the problem. For some reason it spits out version 1.15.0.6, even though 'cabal info pandoc` says I have version 1.17.1:

pandoc -v
pandoc 1.15.0.6
Compiled with texmath 0.8.3, highlighting-kate 0.6.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler, go,
    haskell, haxe, html, idris, ini, isocpp, java, javadoc, javascript, json,
    jsp, julia, kotlin, latex, lex, lilypond, literatecurry, literatehaskell,
    lua, m4, makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
    metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
    objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, pike,
    postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, rhtml,
    roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
    yacc, yaml, zsh
Default user data directory: /home/alexandra/.pandoc
Copyright (C) 2006-2015 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

and

cabal info pandoc
* pandoc           (programs and library)
    Synopsis:      Conversion between markup formats
    Versions available: 0.45, 0.46, 1.17.1, 1.17.2, 1.18, 1.19, 1.19.1, 1.19.2,
                        1.19.2.1 (and 93 others)
    Versions installed: 1.17.1

I guess the question then is how do I tell my machine (Linux Mint) to use the cabal version? I did actually do sudo apt-get remove pandoc before installing the cabal version but evidently that didn't remove it.

rougier commented 7 years ago

Even worse for me, cabal reports pandoc as not being installed.

However in my case, if I remove my local ~/.cabal/bin/pandoc-crossref I get the same error message as you. Can you try to make a link from ~/.cabal/bin/ to the pandoc-crossref binary and check if this works?

rougier commented 7 years ago

This link gives some information https://groups.google.com/forum/#!topic/pandoc-discuss/OZ2s19xu_bg

alexdiem commented 7 years ago

The offending version of pandoc came from Anaconda, so I uninstalled it there. But I didn't quite get where you suggest I should put a link to where? In ~/.cabal/bin/ I have both pandoc and pandoc-crossref. The link seems to only have a suggestion for Mac, Linux doesn't have homebrew.

rougier commented 7 years ago

While trying to help you, I realize I don't quite understand my own installation! And you're right, homebrew is only for OSX.

One mor thing to try: once you've installed the pandoc-crossref package, do you know where is the binary is actually located? If yes, then you can try to replace (in the Makefile) the line:

--filter ~/.cabal/bin/pandoc-crossref \

with the actual path.

--filter /path/to/pandoc-crossref \
alexdiem commented 7 years ago

That's the exact path for pandoc-crossref on my machine already. I got a bit further in the meantime though. After I uninstalled pandoc from Anaconda I added ~/.cabal/bin to the PATH variable and now I get a different error message running make:

pandoc-crossref: Error in $: expected product (:*:), encountered Object
pandoc: Error running filter /home/alexandra/.cabal/bin/pandoc-crossref
Filter returned error status 1
Makefile:10: recipe for target 'rescience-template.tex' failed
make: *** [rescience-template.tex] Error 83

Same expected product (:*:) error happens for the demo.md file.

rougier commented 7 years ago

I think you may still have several pandoc version installed. Is the a pandoc binary inside your .cabal/bin? Is it the one you're calling?

alexdiem commented 7 years ago

which pandoc returns the .cabal/bin path so that should be the one it's using I would assume.

alexdiem commented 7 years ago

Got it all to work now. Required steps were: