I am struggling with the same problem... Any luck finding a way to top-align everything?

I wrote an R package that generates multiple-line grid tables with images. Converting to html or Word works well, but I haven't found a way to make it work for pdf. Here is a simplified example:

+-----------+--------------+----------------+
| Color     | Counts       | Chart          |
+===========+==============+================+
| 1\. Red\  | 410 (41.0%)\ | ![](chart.png) |
| 2\. Blue\ | 320 (32.0%)\ |                |
| 3\. Other | 270 (27.0%)  |                |
+-----------+--------------+----------------+

Rendered pdf looks like this:

SumatraPDF_ti8GE9lt63.png


Clearly there is no obvious solution. Moreover, I have to work withing the constraints inherent to R packages; post-processing tweaks (like the python script mentioned in the original post) is not really an option. The solutions I can foresee involve one or several of the following (I could be missing something, too):
  1. adding inline latex to the markdown table (not sure that's possible without bad side-effects on column widths)
  2. finding the right combination of Pandoc parameters (I can't find anything in the documentation, but maybe I've missed something)
  3. using an R package that allows enhanced latex control: markdown, rmarkdown, or maybe some other package I haven't come across
I'm fully aware that R programming is not within the scope of this group. What I'm hoping for is some feedback or guidance regarding the first two points above. If there is no way to make it work, then I'll start working on the 3rd option.

So far the best workaround I have is using wkhtmltopdf, but in terms of R Markdown integration, it's not looking too good.

I'm including the example chart here for the sake of reproducibility (I uploaded it here as well):
chart.png

Any help would be most welcome! Thanks

On Sunday, 27 October 2019 15:45:41 UTC-4, ChrisD wrote:
I have some tables where I have an image in the first column, and text in the second column. For example

````md
---------------------- ---------------------------------------------------------------------------
![](ButtonZ.png)       The Z button will do ...

![](ButtonX.png)       The X button will do ...
---------------------- ---------------------------------------------------------------------------
````

For HTML output, the buttons and text are vertically centered in their cells. For PDF output, it appears that the text is aligned so the bottom of the first line of text lines up with the bottom of the image.

I would like to have the table contents top aligned -- the top of the text is aligned with the top of the image. Is there any way to do that?

I found the image-in-table filter (https://github.com/zommerfelds/pandoc-image-in-table), which makes an adjustment for pdf output. The result is similar to HTML, in that the bottom of the text is aligned with the center of the image. Perhaps I could modify this filter (or convert it to a lua filter), but how would I calculate the amount to move up? And how would I duplicate this effect in html?

Thanks,

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7dfc160b-b1b7-4535-bfa5-e2863961dc4e%40googlegroups.com.