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

Convert Latex tabular to plain markdown format #61

Merged
merged 5 commits into from
Jul 20, 2019
Merged

Convert Latex tabular to plain markdown format #61

merged 5 commits into from
Jul 20, 2019

Conversation

mcol
Copy link
Contributor

@mcol mcol commented Jul 8, 2019

Submission Checklist

  • Builds locally
  • Declare copyright holder and open-source license: see below

Summary

With this, the table is properly displayed also in the html version. This fixes #51.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Marco Colombo

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

mcol added 2 commits July 8, 2019 20:56
With this, the table is properly displayed also in the html version.
This fixes #51.
This allows to have better control on the formatting of the tables for both
html and pdf outputs while avoiding duplicate code for the two formats.

This also removes the few other uses of Latex \tabular, so that more missing
tables will now appear in the html document.

Since Latex minipages are not displayed in the html version if used directly,
in sparse-ragged.Rmd we use knitr:::pandoc_to() to check the format being
generated: if html, then we issue standard html table markup, otherwise we
use \minipage.

The two uses of \caption have been removed and the text now flows as a
normal paragraph (idea taken from @enbrown's PR).
@mitzimorris
Copy link
Member

mitzimorris commented Jul 19, 2019

tried to build your branch on my system - failed with this error:

/usr/local/bin/pandoc +RTS -K512m -RTS _main.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output _main.tex --table-of-contents --toc-depth 2 --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --number-sections --highlight-style tango --pdf-engine pdflatex --include-in-header header.tex --variable graphics=yes --wrap preserve --variable 'geometry:margin=1in' --variable 'compact-title:yes' --include-in-header /var/folders/sc/0f0wdc_11_xgjs2v52g20fvr0000gn/T//Rtmpo3Daaz/rmarkdown-str1834450e16248.html --variable tables=yes --standalone --filter /usr/local/bin/pandoc-citeproc 
! LaTeX Error: Option clash for package xcolor.

local pandoc version and info:

~/tmp/docs-issue_51> /usr/local/bin/pandoc --version
pandoc 2.2.1
Compiled with pandoc-types 1.17.4.2, texmath 0.11, skylighting 0.7.1
Default user data directory: /Users/mitzi/.pandoc

@mitzimorris
Copy link
Member

found this, but suggestion didn't work on my machine -
haozhu233/kableExtra#274

This is an attempt to fix the following error that appears in some systems
because of a conflict caused by kableExtra:

   ! LaTeX Error: Option clash for package xcolor.
@mcol
Copy link
Contributor Author

mcol commented Jul 20, 2019

I cannot reproduce your error on my system (Ubuntu Linux):

$ pandoc --version
pandoc 1.19.2.4
Compiled with pandoc-types 1.17.0.5, texmath 0.9.4.4, skylighting 0.3.3.1

Following this https://stackoverflow.com/questions/54257295/latex-error-option-clash-for-package-xcolor-on-cran-debian-builds, I commented out the inclusion of the xcolor package. I didn't see any difference from before in the pdf generated (I looked for url links, as nowhere else I noticed the use of colours). It's worth trying it out and see if it's enough.

There's also another usage of xcolor in file stan-manuals.sty, but I have the impression that this file is unused, as I could compile the guide without it.

@mitzimorris
Copy link
Member

I looked at the tables and one of them calls for striping - that too would involve color. I'll remove it and see what happens.

Copy link
Member

@mitzimorris mitzimorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great - one change requested.

src/stan-users-guide/latent-discrete.Rmd Outdated Show resolved Hide resolved
@mcol
Copy link
Contributor Author

mcol commented Jul 20, 2019

Done. I didn't see any difference in output in either the pdf or html, so I guess it was not really necessary.

This uses an exported function rather than an internal one, and the resulting
code is marginally clearer.
Copy link
Member

@mitzimorris mitzimorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many thanks!

@mitzimorris mitzimorris merged commit 3a5ef5e into stan-dev:master Jul 20, 2019
@mcol mcol deleted the issue_51 branch July 20, 2019 18:30
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

Successfully merging this pull request may close these issues.

Missing table in section 9.4 of Stan-Users-Guide
2 participants