2

I would like to use markdown files with latex. A post on Overleaf really helped me almost solve my issue. The only deal breaker would be inserting tables from markdown into latex. I need help with this. I am very new to latex and have been going back and fourth from markdown. Perhaps I'm in a transition mode.

As you can see I am using the markdown package and inputting sections of my work into the tex file. Everything works well accept for tables. The overleaf post mentions using contentBlocks or inputFencedCode but I can't find any information about how to use those features.

I'm not totally against just simply taking out the markdown package and writing in latex, but I truly appreciate the simplicity of writing in markdown. So, I was hoping to combine my love for both in this and future projects.

\documentclass[man,12pt,floatsintext]{apa6}
\usepackage[american]{babel}
%\usepackage[hybrid]{markdown} %waiting to see if this is a possibility with tables
\usepackage{booktabs}
\title{title}
\shorttitle{title}
\author{author}
\affiliation{affiliation}
\note{date}
\begin{document}
\maketitle
\markdownInput{01Intro.md}
\markdownInput{02Framework.md}
\markdownInput{03Methods.md}
\end{document}

Here is an example .md file I would like to see work in the above .tex:

# Heading

Some important text here, please refer to the following table:

|        | Important | Information |  Here  | 
|:------:|:---------:|:-----------:|:------:| 
| Week 1 |   null  |   null    | null | 
| Week 2 |   null  |    null   | null | 
| Week 3 |   null  |    null   | null |

I hope this important table has lead to your increased 
understanding of this very important topic. I trust that  
it will.
hearsay
  • 133
  • 2
    Welcome to TeX.se, and thanks for posting a minimal document. Unfortunately, however, the one you've posted doesn't really help us because we don't have your included .md files. Can you add an example .md file that doesn't work (and explain what the problem is; it's not really clear what "doesn't work" means). – Alan Munn May 10 '18 at 13:25
  • Unfortunately there is no support for tables in the markdown package. See comments here from the package author. – Alan Munn May 10 '18 at 16:41
  • 1
    As an alternative, you might want to look into pandoc, which converts markdown to LaTeX quite well. – Alan Munn May 10 '18 at 16:47

1 Answers1

2

Here's a version of your document which is compilable with pandoc. The command I used to compile it is:

 pandoc --standalone --variable documentclass=apa6  --variable classoption=12pt --variable classoption=floatsintext --variable classoption=man  markdown-table.md -o markdown-table.pdf

The .md file (markdown-table.md) contains a mixture of Markdown and LaTeX interspersed.

\title{title}
\shorttitle{title}
\author{author}
\affiliation{affiliation}
\note{date}
\abstract{}

\maketitle

# Heading

Some important text here, please refer to the following table:

|        | Important | Information |  Here  |
|:------:|:---------:|:-----------:|:------:|
| Week 1 |   null  |   null    | null |
| Week 2 |   null  |    null   | null |
| Week 3 |   null  |    null   | null |

I hope this important table has lead to your increased
understanding of this very important topic. I trust that
it will.

The output of the 3rd page:

output of 3rd page

Alan Munn
  • 218,180
  • This is so amazing, I don't know how to contain myself! It works! Thank you so much!!! – hearsay May 10 '18 at 17:38
  • @hearsay Just remember it's not a panacea, and debugging is harder since the conversion is all hidden from view. But it is pretty powerful, and for certain kinds of documents, quite useful. – Alan Munn May 10 '18 at 17:44