First and foremost, I have found some solutions here, here, and there but they seem overly complicated for what I am trying to accomplish.
Problem
I am trying to somewhat reproduce the code environment "markdown-style" in LaTeX. I used a colorbox in conjunction with texttt to get a pretty satisfying look but it does not allow line breaks and thus breaks everything when used with paths or long lines.
Question
It is my understanding that colorbox cannot be used to output multiple lines. What could help me achieve this while keeping the code fairly clean?
MWE
\documentclass[draft]{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{geometry}
\usepackage{pdftexcmds}
\usepackage{xcolor}
\newcommand{\code}[1]{\colorbox{black!30}{\textcolor{black!90}{\texttt{\detokenize{#1}}}}}
\newcommand{\codeA}[1]{\colorbox{black!30}{\textcolor{black!90}{\texttt{#1}}}}
\begin{document}
test \code{code} test \code{+}
\lipsum[1]
\codeA{\lipsum[2]}
\end{document}
listingsorminted? Those are both packages for code highlighting and as far as I know they support background color as well as line breaking. I'd start withmintedif you have no problem compiling with-shell-escape.:)– Guilherme Zanotelli Nov 22 '16 at 14:39mintedandlistingsoffer macros to display inline code. Minted macro is:\mintinline{<language>}{code}. – Guilherme Zanotelli Nov 23 '16 at 10:34mintedwhen I find some time. – Akaizoku Nov 23 '16 at 11:11minted? If there's a specific reason you're looking to use the package less perhaps you should see thelistingspackage, I *think* they are compatible . Not using listing packages at all will surely lead to an overcomplicated solution which you seem to want to avoid... – Guilherme Zanotelli Nov 23 '16 at 14:36