I’m trying to define a new environment whose objective is to display an image and a bubble giving some text on the drawing.
One of the thing it could produce would be:
To do this, I’ve find some LaTeX command here and there for the bubble (but I have to confess that I do not understand it...) I modify it to an environment, then I create my own environment.
Here is the (bad) LaTeX code:
\usepackage{graphicx}
\RequirePackage[tikz]{bclogo}
\usetikzlibrary{arrows,shapes,calc}
%to create an ellipse whose contain the text given in parameter
\newcommand{\bulle}[1]
{ \tikz [remember picture,baseline]
{ \node[anchor=base,inner sep=0,outer sep=0] (#1) {{}};
\node[overlay, ellipse callout, fill=gray!50]
at ($(#1.north)+(-.5cm,0.8cm)$) {#1};
}
}
%transform \bulle into an environment
\newenvironment{bullenv}[0]
{ \bulle\bgroup
}
{ \egroup
}
%display an image and a bubble whose position is to be adjusted
\newenvironment{advice}[3]
{ \includegraphics[scale=0.25]{#1}
\hspace{#2}
\vspace{#3}
\begin{bullenv}
}
{ \end{bullenv}
}
I’ve tried to use it like that:
\begin{advice}{Images/dessin.pdf}{9cm}{3cm}
This is my advice
\end{advice}
Unfortunately, it doesn’t work and I do not know how to fix it...
Here is the compilation report:
! Missing \endcsname inserted.
<to be read again>
\bgroup
l.35 \begin{advice}{Images/dessin.pdf}{9cm}{3cm}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
<argument> ...pgf@sh@sa@\tikz@fig@name \endcsname
{\pgf@sh@reanchor {\tikz@s...
l.35 \begin{advice}{Images/dessin.pdf}{9cm}{3cm}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\bgroup
l.35 \begin{advice}{Images/dessin.pdf}{9cm}{3cm}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\bgroup
l.35 \begin{advice}{Images/dessin.pdf}{9cm}{3cm}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
...
l.35 \begin{advice}{Images/dessin.pdf}{9cm}{3cm}
I'm ignoring this, since I wasn't doing a \csname.
! 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.36 T
his is my advice
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 h in font null font!
Missing character: There is no i in font null font!
Missing character: There is no s in font null font!
Missing character: There is no i in font null font!
Missing character: There is no s in font null font!
Missing character: There is no m in font null font!
Missing character: There is no y in font null font!
Missing character: There is no a in font null font!
Missing character: There is no d in font null font!
Missing character: There is no v in font null font!
Missing character: There is no i in font null font!
Missing character: There is no c in font null font!
Missing character: There is no e in font null font!
Overfull \hbox (29.01105pt too wide) in paragraph at lines 35--38
[][] []
[]
Underfull \hbox (badness 10000) in paragraph at lines 35--38
[]
[1
{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map} <./Images/dessin.pdf>] (./essai_3.aux)
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.)
The funny thing is what LaTeX tells:
Pretend that you're Hercule Poirot: Examine all clues, and deduce the truth by order and method.
If someone have an idea, it would be very appreciate.
example-image
so everyone has the image you use.\bulle
takes an argument. You're passing it\bgroup
, but that isn't going to work. You can't name a node\bgroup
.env
package for this so that you can capture the contents of the environment to put in the bubble. But wouldn't a command be simpler here? How much stuff are you going to put in the bubble? Not too much, I'd assume. So why not just define\advice
with 4 arguments?