I'm trying to draw something like the following:
Code for desired effect without using tcolorbox
\documentclass{article}
\usepackage[margin=0.5in,showframe]{geometry}
%%------------------------------
\usepackage{lipsum}
\setlength{\parindent}{0pt}
\begin{document}
\rule{4in}{1pt}
\par
\begin{minipage}[t]{4in}
\lipsum[1]
\end{minipage}
\end{document}
This seems like it should be something straight-forward. But, I'm getting lost in the documentation for tcolorbox
. Nothing I'm doing creates the same effect.
For example, I don't understand what the keys interior hidden
or enhanced
are doing or how they're interacting with each other. Why do the following create such wildly different effects:
First example using tcolorbox
\documentclass{article}
\usepackage[margin=0.5in,showframe]{geometry}
\setlength{\parindent}{0pt}
%%------------------------------
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[width=4in,
%%enhanced,
%%frame hidden,
interior hidden,
boxsep=0pt,
left=0pt,
right=0pt,
top=2pt,
]%%
\lipsum[1]
\end{tcolorbox}
\end{document}
produces
Second example using tcolorbox
\begin{tcolorbox}[width=4in,
enhanced,
frame hidden,
interior hidden,
boxsep=0pt,
left=0pt,
right=0pt,
top=2pt,
]%%
\lipsum[1]
\end{tcolorbox}
produces
Third example using tcolorbox
\begin{tcolorbox}[width=4in,
enhanced,
%%frame hidden,
interior hidden,
boxsep=0pt,
left=0pt,
right=0pt,
top=2pt,
]%%
\lipsum[1]
\end{tcolorbox}
produces:
The documentation says that interior hidden
is shorthand for
interior style={draw=none,fill=none}
but clearly fill=none
is being ignored in the first and third examples. Why?
I've found keys such as enhancedfirst
, enhancedlast
, enhancedmiddle
, nobeforeafter
. But none of these achieve the effects that I want in terms of framing: I just want a bar across the top of the box.
Additional issues:
- The text is formatted differently between the
minipage
environment approach and thetcolorbox
environment even though the widths are the same. - There's a sliver of white space along the left hand side (and who knows where else) that I can't seem to get rid of from the
tcolorbox
environment.
Could someone please show me how to set up a tcolorbox
enivornment to get the effect I want?
Best Answer
You need
boxrule=0pt
andtoprule
commands.Similarly there are
bottomrule
leftrule
and\rightrule
.