I want to be able to insert Markdown text in a LaTeX document with a simple macro, and I want that text to always have a specific background color (e.g. light gray).
I tried using the markdown package some of the solutions listed below without luck:
- Change background color for text block
- Change color and background behind text of all 'description' environments
- Color of enumerate/itemize items in alertblocks and exampleblocks (beamer theme Torino)
I think the challenge that I am facing is that markdown is itself a block.
Here's a MWE where I am trying to use a custom background color for the Markdown block (e.g. light gray).
Ideally the solution is some sort of macro, e.g. mymarkdown.
\documentclass{article}
\usepackage{markdown}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{markdown}
This is now inside Markdown
## Here is a Markdown list
+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy!
## Here are some Markdown blockquotes
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.][1]][1]
\end{markdown}
This is now outside of Markdown
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{document}


tcolorboxenvironment? – David Purton Feb 23 '20 at 04:16\newenvironment{colormarkdown}{\begin{tcolorbox}\begin{markdown}}{\end{markdown}\end{tcolorbox}}and\begin{colormarkdown} ... \end{colormarkdown}, you will getLaTeX Error: \begin{tcb@savebox} on input line ... ended by \end{document}.and the compilation ended with! Emergency stop.and! ==> Fatal error occurred, no output PDF file produced!. – quark67 Feb 26 '20 at 01:24\end{markdown}and this will never occur but you can just do\begin{tcolorbox}\begin{markdown}...\end{markdown}\end{tcolorbox}. – David Purton Feb 26 '20 at 11:07