Comments (21)
@lierdakil Thanks, that was it. While already compiled with inlineMarkdown, I wasn't explicitly setting it as an option for that individual table. This makes good sense though.
@mb21 pandoc-citeproc doesn't factor into this at all, though it's already explicit and last in my filters.
For anyone else, the correct order of filters should be:
- pandoc-placetable
- pandoc-crossref
- pandoc-citeproc
from pandoc-placetable.
So you're applying pandoc-placetable
before pandoc-crossref
and the following gives you a table, but it's not numbered by pandoc-crossref
?
```{#tbl:label .table file="foo.csv"}
```
from pandoc-placetable.
Yes. Taking latex output as an example: no \label
is being generated for the tables e.g. this table
```{#tbl:table3 .table caption="A Placetable Table"}
Banana,8,10.00
```
results in this:
\begin{longtable}[c]{@{}lrr@{}}
\caption{A Placetable Table}\tabularnewline
% rest of table
instead of this:
\begin{longtable}[c]{@{}ll@{}}
\caption{\label{tbl:table3}A Placetable Table}\tabularnewline
% rest of table
All that needs to happen is that a fenced code block identifier starting with #tbl:
needs to be become the label for pandoc-crossref
to be able to reference the table.
from pandoc-placetable.
Right, the Pandoc AST currently doesn't have attributes on tables. That's why the pandoc-crossref filter exists and isn't part of pandoc, see pandoc issue #813.
So there might be a way to get pandoc-placetable
to write out markdown that pandoc-crossref
can parse again, but it would be quite a hack as you would go cat in.md | pandoc --filter pandoc-placetable -t markdown | pandoc --filter pandoc-crossref
. I would rather hope that Pandoc's Table gets Attr
support.
Or modify pandoc-crossref
to parse a table wrapped in a div with the id tbl:label
as a table with such an id... @lierdakil ?
from pandoc-placetable.
I'd also prefer to have Attr
s on tables and whatnot, but that's, regrettably, not something that's doable in near future.
What pandoc-crossref
does to emulate this missing functionality, is it parses last "word" (i.e. token without spaces) in table title as identifier in the form {#tbl:something}
. But implementing that in pandoc-placetable
would have its own set of challenges, I think. So going with a wrapper div seems like a reasonable option (something I was planning on anyway). One caveat though, I'm swamped at the moment, so it might take some time until I can actually get to this. Expect some of it done probably by the end of next week or so.
from pandoc-placetable.
Thanks @mb21 and @lierdakil. I am just starting out with pandoc so am not familiar with the internals and didn't appreciate the complexity.
from pandoc-placetable.
@lierdakil great, if you were planning to do wrapper divs anyhow, I think that's the best solution.
from pandoc-placetable.
Sorry about the hold-up, but I finally got around to this.
v0.1.4.0 is available as package candidate at the moment https://hackage.haskell.org/package/pandoc-crossref-0.1.4.0/candidate. It should treat div-wrapped tables as pandoc-crossref tables with id (same goes for images and display math). One caveat is that div must contain [Plain [item]]
for images/math and [table]
for tables, i.e. no other content is allowed, and inline items have to be wrapped in Plain
instead of Para
.
from pandoc-placetable.
I will publish package candidate when I make sure it works across all relevant configurations (i.e. when tests pass)
from pandoc-placetable.
sound good, I'll close this issue here then...
from pandoc-placetable.
I've tried to use pandoc-placetable with pandoc-crossref as outlined above, but it doesn't seem to work. The reference to the table using [@TBL:table4], shows up as tbl??
Below is what I've used:
```{#tbl:table4 .table header=yes caption="Table caption"}
Fruit,Price,Advantages
Bananas,$1.34,"Bright color"
Oranges,$2.10,"Oranges are orange"
from pandoc-placetable.
Huh. I assumed pandoc-placetable generates a div to keep some attributes like id, but apparently not. You can try wrapping your code block into a div with id. That said, there is a problem with caption, which I will try to fix now.
from pandoc-placetable.
Something like this should work with pandoc-crossref 0.1.5.3, providing it's run after pandoc-placetable.
<div id="tbl:table4">
``{.table header=yes caption="Table caption"}
Fruit,Price,Advantages
Bananas,$1.34,"Bright color"
Oranges,$2.10,"Oranges are orange"
``
</div>
[@tbl:table4]
from pandoc-placetable.
Ok, this works for me. I suppose this is worth noting in the readme, at least over at pandoc-crossref.
I guess a more elegant solution would have to come from pandoc-placetable unless pandoc-crossref were run first. Though for now this is fine.
from pandoc-placetable.
@mb21, do you think you could wrap pandoc-placetable-generated tables in a div if those have id (or for that matter classes) set? Shouldn't be too hard, I think?
from pandoc-placetable.
@lierdakil done: 21f16b5
from pandoc-placetable.
👍
from pandoc-placetable.
I noticed today that if I refer to a table using pandoc-crossref syntax inside of a caption from pandoc-placetable, it isn't referenced.
For example:
```{.table #tbl:table2 header=yes caption="Refer to [@tbl:table1]. "}
Col1, Col2, Col3
That's not parsed by pandoc-crossref at all, and just stays in the caption as is. I'm not sure which of you has a better chance at this or even if it's fixable, but it would be nice to refer to other tables/figures in captions.
from pandoc-placetable.
I should clarify by saying that the order in which the two filters run doesn't affect this either.
from pandoc-placetable.
Maybe specifying pandoc-citeproc explicitly (--filter pandoc-citeproc
) and making sure it is executed as the last of the three filters?
from pandoc-placetable.
@mickley, you probably need to build pandoc-placetable with inlineMarkdown
switch, so that citation is actually parsed by pandoc. Otherwise, pandoc-crossref assumes it's a raw string, and does nothing with it.
from pandoc-placetable.
Related Issues (20)
- cabal: Could not resolve dependencies; ExitFailure 1 HOT 10
- [Feature Request] Support for custom table styles HOT 6
- Requires http-conduit >= 2.2 HOT 3
- Bug Report: LaTeX error when CSV table has block element and no width specified HOT 13
- Feature Request: input from csv directly on cli HOT 1
- compile failure with pandoc-placetable-0.4.2 HOT 6
- Error on csv file HOT 8
- Problem using CSV containing UTF-8 special characters HOT 9
- Error running filter pandoc-placetable: Could not find executable pandoc-placetable HOT 2
- Working with pandoc2? HOT 6
- Compilation Error when Installing with Cabal and Pandoc 2.1.3 HOT 3
- Weird dependencies HOT 1
- [Feature request] Allow LaTeX to be formatted inside tables HOT 1
- Table format HOT 6
- Incompatible API versions HOT 5
- How to install properly? HOT 2
- [Feature Request] Table cell style matching pandoc HOT 10
- [Feature Request] Ability to specify column widths
- Error_EOF when connecting to google domains HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandoc-placetable.