Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

enter image description here

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

enter image description here

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

enter image description here

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:

enter image description here

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:

  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?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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}

enter image description here

share|improve this answer
    
When I copy your example, I still get faint vestiges of the frame. Any ideas why? –  A.Ellett Apr 6 at 1:12
1  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.