TransWikia.com

how to round corners of shaded boxes

TeX - LaTeX Asked on March 1, 2021

I have a shaded text box looking as:

enter image description here

which is generated by the following code?

documentclass{memoir}

usepackage{titling}

usepackage{algorithm,algpseudocode}
usepackage{bm}  % bold greek variables (boldmath)
usepackage{tikz}
usetikzlibrary{positioning}  % use: above left of, etc
usetikzlibrary{calc}

% Required for the ToDo list.
usepackage{ifthen}

usepackage[protrusion=true,expansion=true, kerning]{microtype}
usepackage{enumitem}

usepackage{booktabs}
usepackage{lipsum}
usepackage{wrapfig}



newcommand{secref}[1]{Section~ref{#1}}
newcommand{chapref}[1]{Chapter~ref{#1}}
renewcommand{eqref}[1]{Equation~(ref{#1})}
newcommand{figref}[1]{Figure~ref{#1}}
newcommand{tabref}[1]{Table~ref{#1}}



begin{document}

definecolor{shadecolor}{RGB}{176,224,230}%{246,243,226}
setlengthOuterFrameSep{0pt}
begin{shaded*}
    % medskip 
    textcolor{gray}{}
    textcolor{gray}{textbf{Chapter 1}}
    textcolor{dark_red}{textbf{SUMMARY: }}
    medskip    
    Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text, 
end{shaded*}



setlengthOuterFrameSep{0pt}
begin{shaded*}
    % medskip 
    textcolor{gray}{}
    textcolor{gray}{textbf{Chapter 2}}
    textcolor{dark_red}{textbf{SUMMARY: }}
    medskip    
    Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text, 
end{shaded*}

end{document}

Is there a way to round the corners while keeping rest of the visual features intact?

One Answer

Perhaps tcolorbox makes things easier.

https://ctan.org/pkg/tcolorbox?lang=en

% !TeX TS-program = pdflatex

documentclass{memoir}
usepackage{titling}

usepackage{algorithm,algpseudocode}
usepackage{bm}  % bold greek variables (boldmath)
usepackage{tikz}
usetikzlibrary{positioning}  % use: above left of, etc
usetikzlibrary{calc}

% Required for the ToDo list.
usepackage{ifthen}

usepackage[protrusion=true,expansion=true, kerning]{microtype}
usepackage{enumitem}

usepackage{booktabs}
usepackage{lipsum}
usepackage{wrapfig}

usepackage{tcolorbox}

newcommand{secref}[1]{Section~ref{#1}}
newcommand{chapref}[1]{Chapter~ref{#1}}
newcommand{eqref}[1]{Equation~(ref{#1})}
newcommand{figref}[1]{Figure~ref{#1}}
newcommand{tabref}[1]{Table~ref{#1}} 

begin{document}

definecolor{shadecolor}{RGB}{176,224,230}%{246,243,226}
%setlengthOuterFrameSep{0pt}
%begin{shaded*}
%    % medskip 
%    textcolor{gray}{}
%    textcolor{gray}{textbf{Chapter 1}}
%    textcolor{dark_red}{textbf{SUMMARY: }}
%    medskip    
%    Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text, 
%end{shaded*}
%
%
%
%setlengthOuterFrameSep{0pt}
%begin{shaded*}
%    % medskip 
%    textcolor{gray}{}
%    textcolor{gray}{textbf{Chapter 2}}
%    textcolor{dark_red}{textbf{SUMMARY: }}
%    medskip    
%    Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text,Some text, 
%end{shaded*}


begin{tcolorbox}
    lipsum[3]
end{tcolorbox}


begin{tcolorbox}[colback=white, colframe=blue!20, arc=10pt, title=color{gray} textbf{Chapter 1} color{red}  textbf{SUMMARY:}]
    lipsum[1]
end{tcolorbox}

end{document}

out2

You did not include the environment shaded (perhaps from framed ?) in your code, so I commented these lines.

Answered by Simon Dispa on March 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP