# How do I draw a box with tcolorbox

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.

1. The text is formatted differently between the minipage environment approach and the tcolorbox environment even though the widths are the same.
2. 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?

-

You need boxrule=0pt and toprule commands.

boxrule=0pt,toprule=1pt,


Similarly there are bottomrule leftrule and \rightrule.

\documentclass{article}
\usepackage[margin=0.5in,showframe]{geometry}
\setlength{\parindent}{0pt}
%%------------------------------
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[width=4in,
boxsep=0pt,
left=0pt,
right=0pt,
top=2pt,
arc=0pt,
boxrule=0pt,toprule=1pt,
colback=white
]%%
\lipsum[1]
\end{tcolorbox}

\end{document}


-
When I copy your example, I still get faint vestiges of the frame. Any ideas why? –  A.Ellett Apr 6 at 1:12
@A.Ellett Viewer issues. Try with adobe or some thing else. –  Harish Kumar Apr 6 at 1:16
@A.Ellett I agree to Harish Kumar, it is a previewer problem. If you add the key enhanced jigsaw to the given code, SumatraPDF and Adobe Reader for Windows show a cleaner output. Other viewers on other systems may react differently to the change. –  Thomas F. Sturm Apr 6 at 9:48