Graphics, Figures & TablesBubble text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Bubble text

Post by bstex »

Hi.
I would like to place an image (a talking man) with a bubble text on it, just like in the image:
bubble.jpg
bubble.jpg (12.56 KiB) Viewed 10264 times
I followed some tutorials, but no luck.
Can you help me please?
Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10314
Joined: Mon Mar 10, 2008 9:44 pm

Bubble text

Post by Stefan Kottwitz »

Hi,

welcome to the forum!

This can be a start:

Code: Select all

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{positioning,shapes.callouts}
\begin{document}
\begin{tikzpicture}
  \node (man) {\includegraphics{man}};
  \node [draw, align=center,
         cloud callout, cloud puffs = 17, cloud puff arc=140,
         callout pointer segments = 3, anchor = pointer,
         callout relative pointer = {(330:2cm)},
         aspect = 3, above left = 1.2 and 2 cm of man.north west]
    {This is some text\\and some more in the next line.\\That's all.};
\end{tikzpicture}
\end{document}
You can read about cloud callouts in the tikz manual.

Stefan
LaTeX.org admin
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Bubble text

Post by bstex »

Hi Stefan,
I didn't even know that they are called "callouts".
Thank you so much for your help. ;)
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Bubble text

Post by bstex »

Hi again,
I changed my preamble to this:

Code: Select all

\usepackage[Greek,Latin]{ucharclasses}

% Language declaration
\usepackage{xltxtra}

\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguages{english}

\setTransitionsForGreek{\selectlanguage{greek}}{\selectlanguage{english}}

% Fonts
\setmainfont[Kerning=On,Mapping=tex-text]{Myriad Pro}
because it's much easier to switch languages inside my book.

Since then, my callout code:

Code: Select all

\begin{flushright}
\begin{tikzpicture}
  \node (man) {\includegraphics{man}};
  \node [draw, align=center,
         cloud callout, cloud puffs = 19.5, cloud puff arc=90,
         callout pointer segments = 2, anchor = pointer,
         callout relative pointer = {(345:2.5cm)},
         aspect = 3, above left = -1.5 and 2.5 cm of man.north west]
    {Ένα δύο τρία\\
	τέσσερα πέντε έξι\\
	επτά οκτώ εννιά\\
	δέκα έντεκα};
\end{tikzpicture}
\end{flushright}
shows me this error:

Code: Select all

! Package tikz Error: Giving up on this path. Did you forget a semicolon?.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.100 ^^Iτ
έσσερα πέντε έξι\\
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
Missing character: There is no = in font nullfont!
! Illegal unit of measure (pt inserted).
<to be read again>
=
l.100 ^^Iτ
έσσερα πέντε έξι\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
Missing character: There is no = in font nullfont!
Missing character: There is no ^^B in font nullfont!
Missing character: There is no τ in font nullfont!
Missing character: There is no έ in font nullfont!
When I insert english text inside the callout, it works fine.
Why does greek text have problem with the tikzpicture?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10314
Joined: Mon Mar 10, 2008 9:44 pm

Bubble text

Post by Stefan Kottwitz »

It works when you hide it in a \parbox:

Code: Select all

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage[Greek,Latin]{ucharclasses}
 
% Language declaration
\usepackage{xltxtra}
 
\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguages{english}
 
\setTransitionsForGreek{\selectlanguage{greek}}{\selectlanguage{english}}

% Fonts
\setmainfont[Kerning=On,Mapping=tex-text]{Times New Roman}
\usetikzlibrary{positioning,shapes.callouts}
\begin{document}
\begin{flushright}
\begin{tikzpicture}
  \node (man) {\includegraphics{man}};
  \node [draw, align=center,
         cloud callout, cloud puffs = 19.5, cloud puff arc=90,
         callout pointer segments = 2, anchor = pointer,
         callout relative pointer = {(345:2.5cm)},
         aspect = 3, above left = -1.5 and 2.5 cm of man.north west]
    {\parbox{3cm}{\centering Ένα δύο τρία\\
	τέσσερα πέντε έξι\\
	επτά οκτώ εννιά\\
	δέκα έντεκα}};
\end{tikzpicture}
\end{flushright}
Stefan
LaTeX.org admin
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Bubble text

Post by bstex »

Thanks again, Stefan. ;)
Post Reply