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.

The snippet

\documentclass[png,convert={density=600}]{standalone}
\usepackage{times,fancybox,varwidth,color}
\pagecolor{cyan}
\cornersize{1}

\begin{document}
\ovalbox{\large Hello}
\end{document}

generates the png image

Hello

with the help of pdflatex -shell-escape question.

How do I make the background fill just the ovalbox (while the ovalbox appears with no boundary)?

share|improve this question
    
If you are ok with using tikz package then you can use \begin{tikzpicture} \node [draw=none, fill=cyan, rounded corners=5pt] {\large Hello}; \end{tikzpicture}. –  Peter Grill Jan 28 at 18:47
    
I was hoping to delay reading the tikz documentation even longer, but whatever works is fine. If you are ok with my marking your answer as the correct one, but then marking another if it turns out a solution without tikz is possible, please add an answer. –  Calaf Jan 28 at 19:31
    
You also can use pstricks (and auto-pst-pdf if you do not want to go the way latex -> dvi -> dvipdf) with this line:\psframebox*[fillcolor=cyan, framearc=0.5]{\large Hello} –  Bernard Jan 28 at 20:38
    
This is not as easy with fancybox since the box is constructed using 4 straight rules (top/bottom + left/right) and four corners (upper left/right, lower left/right). There is no single structure to bound colour within. Graphics packages like tikz and pstricks can manage this without problem though. –  Werner Jan 28 at 20:38
    
@Calaf: Yep, I can understand why one would want to postpone learning tikz, but if you are doing any serious drawings (or already know pstricks), resistance is futile :-). –  Peter Grill Jan 28 at 21:35

2 Answers 2

up vote 6 down vote accepted

With tcolorbox?

enter image description here

Code:

\documentclass[png,convert={density=600}]{standalone}
\usepackage{times,tcolorbox}
\newtcbox{\myovalbox}{colback=cyan,boxrule=0pt,arc=5pt,
  boxsep=0pt,left=3pt,right=3pt,top=3pt,bottom=3pt}

\begin{document}
\myovalbox{\large Hello}
\end{document} 
share|improve this answer

Here is a tikz solution:

enter image description here

Code:

\documentclass[png,convert={density=600}]{standalone}
\usepackage{times}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \node [fill=cyan, rounded corners=5pt] {\large Hello};
\end{tikzpicture}
\end{document}
share|improve this answer
    
My sequel question (tex.stackexchange.com/q/156406/9549) applies equally to tcolorbox and to tikz :). –  Calaf Jan 28 at 21:38

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.