Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2578  / 2 Years ago, sun, october 2, 2022, 1:10:58

I am using pandoc to convert a LaTeX document to Word format. The source document contains various cross-references that need to be kept in the output. However, when the cross-references filter is used pandoc complains that it is not installed:


$ pandoc main.tex --filter pandoc-crossref -o main.docx
Error running filter pandoc-crossref:
Could not find executable pandoc-crossref

A package with Python bindings for filters is installed:


$ dpkg -l |  grep pandoc
ii pandoc 2.5-3build2 amd64 general markup converter
ii pandoc-data 2.5-3build2 all general markup converter - data files
ii python3-pandocfilters 1.4.2-2 all python3 bindings for Pandoc's filters

So I would assume that filters are included in the general pandoc package. It could be that the cross-references filter is somehow missing.


But there are no other filter packages available:


$ aptitude search pandoc | grep filter
p pandoc-plantuml-filter - Pandoc filter: converts PlantUML code blocks to PlantUML images
i A python3-pandocfilters - python3 bindings for Pandoc's filters
$ aptitude search pandoc | grep cross
$

Is this filter simply not packaged and needs to be manually installed? Or is there some other way of using it on Ubuntu?


More From » 20.04

 Answers
1

This filter can not be obtained from a PPA or any other packaging resource. The safest option is thus to compile the filter in the system, as N0rbert suggests. However, the compilation instructions at the filter repository do not apply to Ubuntu. Those instructions expect the system to have state-of-the-art software, which is usually not the case in a packaged software ecosystem like that offered by Ubuntu. Here are the instructions that got it working on my system.


To compile pandoc-crossref you must install haskell-stack, the toolchain that compiles the filter.


sudo aptitude install haskell-stack

Here is the first tricky bit. The haskell-stack package available from the Universe is really old, dates back to 2018, meaning that there isn't much it can actually do. Luckily the programme can update itself, running the following:


stack upgrade --binary-only

Now the source code can be cloned. However, the right version must be obtained, with a recent one the compilation fails. This is because the pandoc package in the Universe is also old, from 2019, therefore a matching version must be checked out:


cd git
git clone https://github.com/lierdakil/pandoc-crossref.git
cd pandoc-crossref
git checkout v0.3.4.2

And finally the filter can be compiled:


stack install

This will install the compiled filter to ${HOME}/.local/bin which in my case is just fine.


This method was figured out in this thread.


[#1614] Monday, October 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oleard

Total Points: 344
Total Questions: 105
Total Answers: 113

Location: Bonaire
Member since Tue, Sep 20, 2022
2 Years ago
oleard questions
Mon, Sep 26, 22, 18:21, 2 Years ago
Mon, Nov 1, 21, 21:27, 3 Years ago
Sat, May 7, 22, 20:47, 2 Years ago
Sun, Jul 24, 22, 18:15, 2 Years ago
;