Is it possible to make a rounded corner for the tex code listing? Given:
\documentclass[10pt]{article}
\usepackage[usenames,dvipsnames]{xcolor} %used for font color
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{listings}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\begin{document}
\definecolor{lbcolor}{rgb}{0.1,0.1,0.1}
\lstdefinestyle{mystyle}{
basicstyle=\ttfamily\color{White},
language=Java,
tabsize=1,
keywordstyle=\color{Red}\bf,
showstringspaces=false,
morekeywords={public, class}
}
\newtcblisting{mylisting}{
arc=0pt,
top=0mm,
bottom=0mm,
left=0mm,
right=0mm,
boxrule=0pt,
colback=black,
listing only,
listing options={style=mystyle},
hbox
}
\begin{mylisting}
public class MyObject{
public MyObject(){
System.out.println("MyObject");
}
}
\end{mylisting}
\end{document}
I would like to make a rounded corner. This code will be included in a presentation, and although only a cosmetics issue, it looks much appealing when you have nice rounded corners and shadows. Is it possible to do in in Latex?
Best Answer
The option
arc
is provided for this purpose. You have set it to0pt
. Change its value to say some thing like5mm
(say). Further, you can add shadows withenhanced
option andskins
library oftcolorbox
. The syntax would beFull code: