Git Product home page Git Product logo

Comments (9)

mcol avatar mcol commented on May 20, 2024

That's not the only one. Also a table in 7.3 (Collective Cormack-Jolly-Seber Model) and one in 8.1 (Sparse Data Structures) missing. In all cases they use a Latex tabular (these are the only cases in the user's guide).

I've rewritten the table of 9.4 as a standard markdown table: the result in pdf is almost identical as the previous version (barring an extra horizontal line above the table and the lack of a vertical line after the first column). The html version is ok, perhaps it could be improved with a bit of css, but at least it's there now. If it's fine I could try to convert also the other ones (although one of them uses minipages, which I don't know if they would be rendered in html).

from docs.

bob-carpenter avatar bob-carpenter commented on May 20, 2024

@mcol: converting more of these would be great. I'm embarassed I missed so many of them. I'm not sure how you can work from @enbrown's branch, but these don't all need to be fixed in the same PR.

from docs.

enbrown avatar enbrown commented on May 20, 2024

I think that these will come in through the same PR. Here's the HTML I came up with for the sparse data structure table:
https://github.com/enbrown/stan-docs/blob/cd453fc8075445d7db3f5409aceb8448e0373240/src/stan-users-guide/sparse-ragged.Rmd#L33-L66

And here's the HTML for the latent-discrete Rmd file:
https://github.com/enbrown/stan-docs/blob/cd453fc8075445d7db3f5409aceb8448e0373240/src/stan-users-guide/latent-discrete.Rmd#L488-L510

Of course, this isn't the only way of doing it. So if someone has a better idea, that's fine with me.

from docs.

mcol avatar mcol commented on May 20, 2024

I didn't see that these were being fixed in the other PR. It's a matter of deciding whether there should be two specialized implementations of the same table (html and latex) or a plain one in markdown. My preference would be the unified approach for maintainability, but I can see that @enbrown's approach may look better.

from docs.

bob-carpenter avatar bob-carpenter commented on May 20, 2024

from docs.

enbrown avatar enbrown commented on May 20, 2024

The problem is that markdown syntax for tables is very limited. There is no markdown syntax to have cells span multiple columns or rows and none of the table borders/lines can be adjusted. So having column headers that span multiple columns (to group related columns) or doing something simple like having a border between the first and second columns (such as in the otherwise simple table in section 9.4) isn't possible. Even the many RMarkdown table-making packages seem to sometimes skip the markdown code and instead directly output HTML code to make a presentable table.

So I see three options (not mutually exclusive):

  1. Use limited markdown tables that don't look good in either HTML or PDF but are easier to make
  2. Use an R package that would generate each based on the output format (maybe xtable?)
  3. Create markup in both HTML and LaTeX for the tables

Any other ideas?

from docs.

mcol avatar mcol commented on May 20, 2024

If we go the package way, we could use knitr::kable and the kableExtra package (https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_html.html).

from docs.

betanalpha avatar betanalpha commented on May 20, 2024

from docs.

mcol avatar mcol commented on May 20, 2024

I've pushed another approach in #61 which allows nice formatting for both html and pdf documents based on kable. This avoids duplication of the code while making the tables still readable also when unformatted. It requires a bit of knitr magic in order to put tables side by side, as html_document doesn't show at all Latex minipages, while pdf_document completely ignores the html table markup.

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.