0

I'm trying to build up a new documentation system using Markdown and LaTeX. After several hours most things are running smooth, but tables are a bit complicated.

Most of the text can be written with Markdown syntax, included by

\usepackage[fencedCode,inlineFootnotes,citations,definitionLists,hashEnumerators,smartEllipses,hybrid]{markdown}

But tables with defined cell-widths and multicolumns have to be done in LaTeX native code.

To make the document more easy to write down, I am planning to create a LaTeX macro creating these tables. So the writer only has to fill some macro variables and LaTeX is buliding the table.

Even this is almost working BUT

I have to stop the Markdown environment with \end{markdown} just before creating the table and entable Markdown with \begin{markdown}. This isn't working well within the document like:

\end{markdown}

\marcocreatetable
    {parameter 1}
    {parameter 2}

\begin{markdown}

But, when trying to put these commands to the macro like

\newcommand{\marcocreatetable}[2]{

\end{markdown}
\begin{longtable}{>{\columncolor[gray]{0.8}}p{2.5cm}|p{2.5cm} p{2.5cm} p{3.5cm} p{2.5cm}}
         \arrayrulecolor{red}\hline
        Cell1&\multicolumn{2}{l}{S\{1\} #1}&\multicolumn{2}{r}{#2}\\\hline
        Cell x&cell y &\multicolumn{1}{c}{\textbf{cell w}}&cell z&\multicolumn{1}{c}{\textbf{6}}\\
\end{longtable}
\begin{markdown}
}

an using the macro like

%\end{markdown}

\marcocreatetable
    {parameter 1}
    {parameter 2}

%\begin{markdown}

LaTeX complains about

\begin{document} ended by \end{markdown}.

Seems ending markdown within the makro is not working very well. And yes, ending markdown at the beginning of a macro and starting markdown at the ending of a macro maybe bad code, but I'd like to create a table with just a single command.

Any suggestions to a big LaTeX noop?

  • you have not provided any usable example so it is hard to answer but if the markdown environment changes catcodes then it is like verbatim and can not be used in the argument of any command. – David Carlisle Mar 8 at 9:35
  • Since the release of version 2.8.0, the Markdown package supports tables. – Witiko Jun 4 at 1:30
1

I did find a solution.

Within the macro, I have to use \endmarkdown{} instead of \end{markdown}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.