How do you left align an entire table in Markdown/Pandoc? I know about different ways of specifying tables and how alignment of columns are done, but I cannot find a way to shift the table from center aligned to left aligned (have even tryed embedding <div style="float: left>..</div>
which didn't work). Do I have to switch to LaTeX to do this? I will export to pdf later on, if that makes a difference.
Tables are center-aligned by default when they are included in a table environment (i.e., when the table has a caption). If you do not want to center a table, use the argument centering = FALSE.
You can also use r to align the text to the right and l for left alignment. This will insert a horizontal line on top of the table and at the bottom too. There is no restriction on the number of times you can use \hline .
I now found a solution to this problem at tex.stackexchange.com. Apparently pandoc inserts \centering
for every float in the document. This can be cancelled by inserting \let\centering\relax
in a custom preample to pandoc (as pandoc argument -H custompreample.tex
). The link also describes more detailed ways to for example define different floats for tables and figures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With