Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The key "SoftBreak" was not found - after update to pandoc 1.16 #50

Closed
HJAllen opened this issue Jan 12, 2016 · 17 comments
Closed

The key "SoftBreak" was not found - after update to pandoc 1.16 #50

HJAllen opened this issue Jan 12, 2016 · 17 comments

Comments

@HJAllen
Copy link

HJAllen commented Jan 12, 2016

Working on a win 7 professional system with RStudio/R/rmarkdown/pandoc. Updated to pandoc 1.16 and crossref 0.1.6.3 via cabal. Seems something else needs to be updated. Result is:

pandoc-crossref.exe: Error in $[2][29]: The key "SoftBreak" was not found
pandoc.exe: Error running filter pandoc-crossref
Filter returned error status 1
Error: pandoc document conversion failed with error 83

Full output:

"C:/path/cabal/bin/pandoc" +RTS -K512m -RTS 2015HarshaText.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output 2015HarshaText.pdf --filter pandoc-citeproc --template "c:\path\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --include-in-header "c:\\;path\\HABsPDFheader.tex" --filter pandoc-crossref --variable "geometry:margin=1in" --bibliography "c:\\path\\HABs.bib" 
output file: 2015HarshaText.knit.md

pandoc-citeproc: reference fig:MCStruct not found
pandoc-crossref.exe: Error in $[2][29]: The key "SoftBreak" was not found
pandoc.exe: Error running filter pandoc-crossref
Filter returned error status 1
Error: pandoc document conversion failed with error 83
In addition: Warning message:
running command '"C:/path/pandoc" +RTS -K512m -RTS 2015HarshaText.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output 2015HarshaText.pdf --filter pandoc-citeproc --template "c:\path\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --include-in-header "c:\\path\\HABsPDFheader.tex" --filter pandoc-crossref --variable "geometry:margin=1in" --bibliography "c:\\path\\HABs.bib"' had status 83 
Execution halted
@lierdakil
Copy link
Owner

It seems that pandoc-crossref was built with different version of pandoc than you're running. Make sure that you build pandoc and pandoc-crossref in the same sandbox. Also run ghc-pkg check if you're not using sandboxes, it's possible that some packages are broken by updates.

@HJAllen
Copy link
Author

HJAllen commented Jan 12, 2016

I reinstalled crossref and it will process and create the pdf. However it does not label the figures appropriately nor insert the reference. Unfortunately, I haven't used a sandbox, in fact I am not familiar with it. Perhaps I need to wipe the slate clean and start over.

@lierdakil
Copy link
Owner

Let me know if it doesn't help. It's always possible I messed up somewhere.

@HJAllen
Copy link
Author

HJAllen commented Jan 13, 2016

I reinstalled everything and got the same result. I am not familiar with the sandboxes. My preliminary investigation shows that sandboxes can be set up for each build. So, should I set up a sandbox for pandoc and a separate on for crossref? Sorry for the basic question...

@lierdakil
Copy link
Owner

Wait. I think I might have misinterpreted error log you provided. Sorry. Sleep deprivation does that. Could you show what command do you use to run Pandoc?

@HJAllen
Copy link
Author

HJAllen commented Jan 13, 2016

I have altered the paths to protect the innocent

"C:/path/cabal/bin/pandoc" +RTS -K512m -RTS 2015HarshaText.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output 2015HarshaText.pdf --filter pandoc-citeproc --template "c:\path\R\library\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --include-in-header "c:\\path\\HABsPDFheader.tex" --filter pandoc-crossref --variable "geometry:margin=1in" --bibliography "c:\\path\\Lake-Harsha\\HABs.bib" 

@lierdakil
Copy link
Owner

Okay... Could you change order of filters so that pandoc-crossref appears before pandoc-citeproc and test that one out?

@HJAllen
Copy link
Author

HJAllen commented Jan 13, 2016

I am using Rstudio and don't know exactly how the pandoc command is generated. I am looking into it... Thanks for the help!

@HJAllen
Copy link
Author

HJAllen commented Jan 14, 2016

i was able to run the command manually but didn't fix the problem. Here is a bit more description of what I am doing.

markdown snippet:

####Structure

Microcystins are cyclic heptapeptides @fig:MCStruct with @campos_molecular_2010

![Microcystin Structure](../figures/microcystin.png){#fig:MCStruct}

output in pdf

Structure
Microcystins are cyclic heptapeptides ??? with [1]

command:

"C:/path/cabal/bin/pandoc" +RTS -K512m -RTS HABsLitReview.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output HABsLitReview.pdf --filter pandoc-citeproc --template "c:\path\R\library\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --include-in-header "c:\\path\\HABsPDFheader.tex" --filter pandoc-crossref --variable "geometry:margin=1in" --filter pandoc-citeproc --bibliography "c:\\path\\HABs.bib"

@lierdakil
Copy link
Owner

You're using pandoc-citeproc twice here:

"C:/path/cabal/bin/pandoc" +RTS -K512m -RTS HABsLitReview.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output HABsLitReview.pdf --filter pandoc-citeproc --template "c:\path\R\library\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango --latex-engine pdflatex --include-in-header "c:\path\HABsPDFheader.tex" --filter pandoc-crossref --variable "geometry:margin=1in" --filter pandoc-citeproc --bibliography "c:\path\HABs.bib"

while in fact --bibliography implies --filter pandoc-citeproc (as per README)

Please remove first instance of --filter pandoc-citeproc (in fact you can safely remove both, but that's up to you)

@lierdakil
Copy link
Owner

Hell, there is one more problem. --include-in-header also overrides header-includes metadata that pandoc-crossref uses with LaTeX output. I should probably add this caveat to README.

You could probably add pandoc-crossref definitions yourself, but actual definitions depend on filter settings.

Here is the default verision for reference:

\AtBeginDocument{%
\renewcommand*\figurename{Figure}
\renewcommand*\tablename{Table}
}
\AtBeginDocument{%
\renewcommand*\listfigurename{List of Figures}
\renewcommand*\listtablename{List of Tables}
}
\usepackage{float}
\floatstyle{ruled}
\makeatletter
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\makeatother
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}

@HJAllen
Copy link
Author

HJAllen commented Jan 26, 2016

Further investigation revealed the following in the .tex file produced by pandoc

\paragraph{Structure}\label{structure}

Microcystins are cyclic heptapeptides Figure\ref{fig:MCStruct} with

\includegraphics{../figures/microcystin.png}

\paragraph{Mode of Action}\label{mode-of-action}

Is this the intended? The \includegraphics is not wrapped in \figure and has no label.

Also, I have read some other posts regarding the integration of cross referencing in pandoc and it seems this issue is still quite up in the air. can you provide any insight into where this is going?
Thanks!

@tolot27
Copy link

tolot27 commented Jan 26, 2016

Maybe there is no label because of a bug in the latest pandoc version (1.16.x). See here for a pull reguest: 2637.

BTW: I run into the SoftBreak issue too but fix it by using the latest Haskell platform 7.10.3 and compiled everything again.

@lierdakil
Copy link
Owner

Okay, so I messed up badly with 0.1.6.4 release, it pretty much broke LaTeX output for figures. 0.1.6.5 should work.

jgm/pandoc#2637 shouldn't affect anything until released, since pandoc-crossref manages LaTeX labels by itself. I will have to remove that after next pandoc release (since I have no idea which version will have that PR included, I can't do that until release)

@HJAllen, I have literally no idea why \includegraphics is not wrapped in figure environment. It should be. All I can suggest is try updating to pandoc-1.16.0.2 and pandoc-crossref-0.1.6.5.

@HJAllen
Copy link
Author

HJAllen commented Jan 27, 2016

success. I updated pandoc and pandoc-crossref to latest. I am using Rstudio and knitr which has the pandoc options 'hard coded' in the knit function so I used a lower level command rmarkdown::pandoc_convert to provide the filters in the appropriate order as in:

rmarkdown::pandoc_convert("HABsLitReview.Rmd", to="latex",output='HABsLitReview.pdf',citeproc=FALSE,options=c('--filter','pandoc-crossref','--filter','pandoc-citeproc.exe'),verbose=TRUE)

@lierdakil
Copy link
Owner

@HJAllen, FYI, rstudio/rmarkdown@07da257 fixes filter order issue. rmarkdown 0.9.3 should have that once released.

@HJAllen
Copy link
Author

HJAllen commented Jan 27, 2016

great! thanks for the pointer.
Also, thank you for your hard work on this filter. As far as my workflow goes, cross-refs, or lack of, were the last thing holding me back and your solution makes markdown and pandoc a great tool!

@HJAllen HJAllen closed this as completed Jan 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants