I use XeLaTeX, but I can not use both or similar or duplicate packages, because someone said it is bad idea in XeLaTeX. I would like to use only minted.
Here are two answers which offer inline code with rounded corners, but only for lstinline and minted:
- How do I set a background color and font for inline verb text?
- Advanced customization of Minted code?
But in these links, both they depend on listings.
Few codes taken from the one of two links and I readjusted few commands and words, as principally replacing listing. for minted and \lstinline. for \mintline, without depending on listings, but it does not work without listings. Here is the smaller code:
\documentclass[10pt, a4paper, portuguese]{abntex2}
\usepackage{etoolbox}
\usepackage{tcolorbox}
\tcbuselibrary{minted, skins, xparse}
\BeforeBeginEnvironment{minted}{\vspace{2mm}\begin{tcolorbox}[colback=bg, colframe=bg, arc=1.2pt]}%
\AfterEndEnvironment{minted}{\end{tcolorbox}\vspace{2mm}}%
\usepackage{newverbs}
\definecolor{inline}{RGB}{187,57,82}
\newverbcommand{\cverb}{\color{inline}}{}
\usemintedstyle{paraiso-dark}
\DeclareTotalTCBox{\commandbox}{ s v }
{minted, enhanced, frame hidden, arc=2pt}
{\IfBooleanTF{#1}{\textcolor{red}{\ttfamily\bfseries > }}{}%
\mintinline{#1}{#2}^#3^}
\begin{document}
\commandbox{php}{<?php echo "Hello!" ?>}
\end{document}
And without depending on listings and with tikz from Making Inline Code Printing Pretty, I only replaced {\texttt{#2}} for {\mintinline{#1}{#2}}, but I tested and it did not work error:
\documentclass[10pt, a4paper, portuguese]{abntex2}
%...
\newcommand{\inlinecode}[2]
{
\tikz[baseline=(s.base)]
{
\node(s)
[
rounded corners,
fill = whitesmoke, % background color
% draw = prussianblue, % border of box
text = solitudeblue, % text color
inner xsep = 2pt, % horizontal space between text and border
inner ysep = 0pt, % vertical space between text and border
text height = 2ex, % height of box
text depth = 1ex, % depth of box
#1 % other options
]{\mintinline{#1}{#2}};
}
}
\begin{document}
The basic code in PHP \inlinecode{php}{<?php echo "Hello $name" ?>}
\end{document}
listingsare removed. – moewe Nov 17 '18 at 12:11mintedandlistingsdo very similar things, so it seems not too far-fetched that it should be possibly to use only one of the two. AFAIKmintedandlistingsare not incompatible, so it is not bad to use both, but it is nicer to get away with using only one of the two. – moewe Nov 17 '18 at 12:22\documentclass{...}and ending with\end{document}. – gusbrs Nov 18 '18 at 11:58