Double check how you specify the filter's location. The dot-slash ( ./ ) at the start of the filter means to look in the current directory only. If you put it somewhere else on your path, try it with the dot-slash ("--filter pandoc-word-pagebreak").

Jason

On Wednesday, May 27, 2015 at 5:52:01 PM UTC-5, JO wrote:
I've tried following the instructions provided by Joel exactly, except that I'm using the bash terminal rather than Rstudio to create my output files. My system is Ubuntu 14.04. I get the following error:
"pandoc: Error running filter ./pandoc-word-pagebreak
./pandoc-word-pagebreak not found in path "

Where should the result of "$ghc --make -v pandoc-word-newpage.hs" be stored? I've put all the resulting files in $HOME/.cabal/bin and added this to my path, but this didn't work.

Command to create the output file:

"pandoc -S -o output.odt --filter pandoc-citeproc --filter ./pandoc-word-pagebreak input.md  --reference-odt=template.odt "

Thanks for any advice you may have. I certainly am very unfamiliar with haskell and properly using custom pandoc filters.

On Wednesday, April 22, 2015 at 12:59:38 PM UTC-4, hjal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:

Thanks John!
Note that I had to double up on the backslashes before newpage as in:
insertPgBrks (Para [RawInline (Format "tex") "\\newpage"]) = pgBrkBlock

For a complete summary, here is the system set up, filter and steps I am using to manage page breaks.
System:
RHEL 6.6
ghc 7.8.3
Pandoc 1.13.2.1
R 3.1.3
RStudio 0.98.1028

Filter code:
import Text.Pandoc.JSON

pgBrkXml
:: String
pgBrkXml
= "<w:p><w:r><w:br w:type=\"page\"/></w:r></w:p>"

pgBrkBlock
:: Block
pgBrkBlock
= RawBlock (Format "openxml") pgBrkXml

insertPgBrks
:: Block -> Block
insertPgBrks
(Para [RawInline (Format "tex") "\\newpage"]) = pgBrkBlock
--insertPgBrks (RawBlock (Format "tex") "\newpage") = pgBrkBlock
insertPgBrks blk
= blk

main
= toJSONFilter insertPgBrks

compile the filter
$ghc --make -v pandoc-word-newpage.hs

.Rmd file
---
title
: "Test Doc"
author
: "Joel Allen"
date
: "04/16/2015"
output
:
  word_document
:
    pandoc_args
:
   
- --filter
   
- pandoc-word-newpage
---
\newpage

Test Page 1

\newpage

Test Page 2

I then knit to word, pdf, or html in Rstudio.  Word and pdf now put pagebreaks in the same place.

Thanks to all for the advice!

Joel

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/80fea665-4fd6-499c-a375-2dd46e4e9d1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.