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}
Best Answer
You can use
tcolorbox
and coercemarkdown
into opening atcolorbox
before doing its business, issuing\end{tcolorbox}
at the end.Add the desired options to the starting
\begin{tcolorbox}
(look at the very detailed manual).