user1002430
user1002430

Reputation:

What is the Markdown equivalent to LaTeX's description environment?

Is there a Markdown equivalent to LaTeX's description environment? This gives an author the ability to generate lists where the first word is boldfaced, like this:

description environment

The LaTeX source would be:

\begin{description}
  \item[First] The first item
  \item[Second] The second item
  \item[Third] The third etc \ldots
\end{description}

I'd like to replicate this in Markdown so that if I run the Markdown through a tool such as pandoc I will get similar results.

Upvotes: 6

Views: 2963

Answers (2)

Carlos Luis Rivera
Carlos Luis Rivera

Reputation: 3653

If you are using the latest version of Pandoc (ver 2.0+), you can use the definition lists notation, as shown below. This would be much easier.

First

: The first item

Second

: The second item

Third

: The third etc

Upvotes: 6

Chris
Chris

Reputation: 137075

Markdown isn't as comprehensive as LaTeX, or even HTML:

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags.

It supports bulleted and numbered lists, but not defiition lists.

However, you mention using "a tool such as pandoc" to process your input file. Pandoc supports inline LaTeX using the raw_tex extension:

Extension: raw_tex

In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be included in a document. Inline TeX commands will be preserved and passed unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to include BibTeX citations:

This result was proved in \cite{jones.1967}.

Note that in LaTeX environments, like

\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25  & 15 \\
26--35  & 33 \\
36--45  & 22 \\ \hline
\end{tabular}

the material between the begin and end tags will be interpreted as raw LaTeX, not as markdown.

Inline LaTeX is ignored in output formats other than Markdown, LaTeX, and ConTeXt.

So simply including your LaTeX description environment and running Pandoc with the raw_tex extension should give you the result you want.

You may have to specify the source format manually, e.g. by using something like -f markdown_strict+raw_tex in your command.

Upvotes: 4

Related Questions