4

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)?

5
  • 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}. Commented Jan 28, 2014 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
    Commented Jan 28, 2014 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
    Commented Jan 28, 2014 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
    Commented Jan 28, 2014 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 :-). Commented Jan 28, 2014 at 21:35

2 Answers 2

9

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} 
0
3

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}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .