Closed AnthonyEbert closed 5 years ago
Hi, the Markdown parser does not support tables at the moment. Here are several workarounds you can use:
\documentclass{article}
\usepackage[hybrid]{markdown}
\begin{document}
\begin{markdown}
# A table
\begin{tabular}{cc}
Letters & Numbers \\\\ \hline
a & 1 \\\\
b & 2
\end{tabular}
\end{markdown}
\end{document}
\documentclass{article}
\usepackage{filecontents}
\usepackage[contentBlocks]{markdown}
\begin{document}
\begin{filecontents*}{table.csv}
Letters,Numbers
a,1
b,2
\end{filecontents*}
\begin{markdown}
# A table
/table.csv (Letters and numbers)
\end{markdown}
\end{document}
Thank you for the work arounds but they do not solve the problem of streaming content, written in Markdown and using tables, into a larger Latex document. Is support for this an impossibility? Is this something that can be accomplished if a few of us sponsor the work?
Hello @dvins, I agree that the workarounds are imperfect. From the technical viewpoint, tables are completely doable. In fact, I see two ways they can be implemented:
The constraining factor for me is time. There is currently enough open issues for me to have my hands full with just maintaining and documenting the package before the TeX Live 2019 release. A sponsorship would help me find a second contributor specifically to implement table support.
What is the best email to contact you at to discuss sponsorship further? In terms of approach the first is best and preferred so can be leveraged in a system like ShareLaTex as an import library.
You can reach me at witiko@mail.muni.cz
@Witiko Sent you an email the other night.
Table support is now available in the master
branch and will be published in version 2.8.0 by the end of April. See the following example:
\documentclass{article}
\usepackage[pipeTables, tableCaptions]{markdown}
\begin{document}
\begin{markdown}
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
: Demonstration of pipe table syntax.
\end{markdown}
\end{document}
Hello I have been working with table support but I have two issues:
### Documentos oficiales
\vspace{1cm}
ID DOCUMENTO | DESCRIPCIÓN |
---|---|
DOC-1 | Propuesta para el Proyecto Sistema Aéreo No Tripulado de Despegue y aterrizaje Vertical |
Table: Documentos oficiales de referencia
\vspace{1cm}
ID DOCUMENTO | DESCRIPCIÓN |
---|---|
DOC-2 | Manual de Procesos del Sistema de Gestión de Calidad del INIDETAM |
Table: Otras publicaciones aplicables
![My oputput](https://user-images.githubusercontent.com/3085858/57186476-c0834b80-6ea5-11e9-9c48-9607fce91fa9.png)
Hello @rafaelzemog,
let's have a look at the issues you outlined:
- The tables are misplaced eg. at the top of the page when they must be in the middle of the page.
You can specify to LaTeX that it should not make tables float:
\usepackage{float}
\makeatletter
\renewcommand*{\fps@table}{H}
\makeatother
Alternatively, when you don't specify a caption, the default LaTeX table renderer will also prevent tables from floating:
### Documentos oficiales
| ID DOCUMENTO | DESCRIPCIÓN |
|:------------:|:------------------------------------------------|
| DOC-1 | Propuesta para el Proyecto Sistema Aéreo No Tripulado de Despegue y aterrizaje Vertical |
### Otras publicaciones técnicas, legales y referenciales
| ID DOCUMENTO | DESCRIPCIÓN |
|:------------:|-------------------------------------------------------------------|
| DOC-2 | Manual de Procesos del Sistema de Gestión de Calidad del INIDETAM |
- I only have the horizontal lines displayed in the table nor the vertical ones.
Omitting vertical lines is generally prefered in modern typesetting. If you want to add horizontal lines, you will need to modify the default table renderer (or write your own):
\usepackage[pipeTables,tableCaptions]{markdown}
\makeatletter
\def\markdownLaTeXReadAlignments#1{%
\addto@hook\markdownLaTeXTableAlignment{|}%
\advance\markdownLaTeXColumnCounter by 1\relax
\if#1d%
\addto@hook\markdownLaTeXTableAlignment{l}%
\else
\addto@hook\markdownLaTeXTableAlignment{#1}%
\fi
\ifnum\markdownLaTeXColumnCounter<\markdownLaTeXColumnTotal\relax\else
\addto@hook\markdownLaTeXTableAlignment{|}%
\expandafter\@gobble
\fi\markdownLaTeXReadAlignments}
\makeatother
Thank you for your support.
Is the multiline header enabled? First of all, thank you for this tool, runs amazingly in neovim with Arch, but in this case, I'm trying to make a table similar to this ` | Año | Total | Carbón | Derivados | Gas Natural | Energía | Energía | Porcentaje | del petróleo | nuclear | renovable | de renovable | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2000 | 420 | 97 | 153 | 86.8 | 28.3 | 54.7 | 13.00 | ||||||||||
2005 | 481 | 125 | 168 | 98.8 | 30.2 | 59.4 | 12.30 | ||||||||||
2010 | 539 | 153 | 173 | 115 | 30.1 | 68.2 | 12.60 | ||||||||||
2015 | 572 | 161 | 182 | 123 | 28.1 | 77.8 | 13.60 | ||||||||||
2016 | 576 | 156 | 184 | 127 | 28.5 | 80.6 | 14.00 | ||||||||||
2017 | 585 | 158 | 186 | 130 | 28.8 | 81.1 | 13.90 |
`
Is this possible or shall I need to make anything different?
@awelormro This is not possible with the pipeTables
syntax extension.
As you can see, GitHub does not render your table either.
For the pipeline table in latex, is there any way the table caption can be on top of the table instead of under the table? Thanks for helping.
@fenggeorgeyu You can use LaTeX packages float
and caption
to control the placement and spacing of captions:
\documentclass{article}
\usepackage[pipeTables,tableCaptions]{markdown}
\usepackage{float,caption}
\begin{document}
\floatstyle{plain} % Setup float package to always put captions below tables
\restylefloat{table}
\captionsetup[table]{position=below} % Setup caption package to place \abovetopsep between caption and table
\begin{markdown}
| Here is a header |
|------------------|
| Here is a row |
: Here is a caption
\end{markdown}
\floatstyle{plaintop} % Setup float package to always put captions above tables
\restylefloat{table}
\captionsetup[table]{position=above} % Setup caption package to place \abovetopsep between caption and table
\begin{markdown}
| Here is a header |
|------------------|
| Here is a row |
: Here is a caption
\end{markdown}
\end{document}
Alternatively, you could redefine the table renderer in any way you see fit. This is more difficult, but you would not have to rely on LaTeX packages table
and float
. Here is the default definition of the table renderer in LaTeX.
Hope this helps! Please, use Discussions for future Q&A on this topic and any other topic.
Your solution of using LaTeX packages float
and caption
works great! I will look into the table render option later on. Thanks for the great help! Definitely, I will ask questions in Discussions in the future. Thanks again!
Thank you for providing this package! I tried to insert a markdown table into a latex document, the table below was not rendered.
Here is the tex file I wrote.
The output came out like this
| Letters | Numbers | | —- | — | | a | 1 | | b | 2 |
when I ranpdflatex -shell-escape file.tex
.Thanks again