2

I'm interested in having text inside a circle, where the text uses the shape of the circle to line-break. The resulting text should also be centered inside the circle.

This is what I'm looking for.

my desired result

If it is not possible to do with the vertical centering, I can also accept a solution that is able to automatically choose the size of the circle, depending on the amount of text.

1 Answer 1

3

You can use shapepar and tikz to get

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{shapepar}
\newsavebox\TestBox
\newcommand\CirledText[1]{\begin{lrbox}{\TestBox}
\Shapepar{\circleshape}\sffamily\hspace{-0.5ex}#1\par
\end{lrbox}%
\begin{tikzpicture}[baseline={([yshift=-0.5em]tst.center)}]
\pgfmathsetmacro{\myradius}{max(\wd\TestBox,\ht\TestBox)+18pt}%
\node[circle,draw=black!70!blue,line width=8pt,fill=white,inner sep=-0.02*\myradius,minimum size=\myradius,
blur shadow={shadow xshift=1ex,shadow yshift=-1ex}] (tst) {\usebox\TestBox};
\end{tikzpicture}
}
\begin{document}
\CirledText{Test}\hspace{3em}
\CirledText{Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}
\end{document}

enter image description here

One may make it very adjustable but how to precisely manage this depends on the use case.

2
  • This looks pretty good. If force a line break in the text, it is no longer centered, like \CirledText{Lorem\\ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.} Do you know why that is?
    – Atnas
    Commented Feb 2, 2020 at 22:41
  • @Atnas AFAIK shapepar is a very sophisticated package that works under the assumption that you do not add manual line breaks.
    – user194703
    Commented Feb 2, 2020 at 22:58

You must log in to answer this question.

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