Evening all: Has anyone got a nicer \speechbubble definition up their sleeve? Here is not-nice one, so you know the floor: \define [1] \speechBubble {\blank \framed [width=.6\textwidth ,autowidth=force,align={flushleft}, background=color, backgroundcolor=darkblue, foreground=color, foregroundcolor=white, frame=off,corner=0,backgroundoffset=5pt,] {#1} ~~~ \tfd \startcolor[darkblue]{'} \stopcolor \tfa \blank} Called with things like: \speechBubble {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.} I guess there are some people with xs metapost skills out there... But is there as simple way to get a nice curved pointer left or right from the bottom of that rounded rectangle frame?
Am 02.02.2011 um 18:12 schrieb Ian Lawrence:
Evening all:
Has anyone got a nicer \speechbubble definition up their sleeve?
Here is not-nice one, so you know the floor:
\define [1] \speechBubble {\blank \framed [width=.6\textwidth ,autowidth=force,align={flushleft}, background=color, backgroundcolor=darkblue, foreground=color, foregroundcolor=white, frame=off,corner=0,backgroundoffset=5pt,] {#1} ~~~ \tfd \startcolor[darkblue]{'} \stopcolor \tfa \blank}
Called with things like:
\speechBubble {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.}
I guess there are some people with xs metapost skills out there... But is there as simple way to get a nice curved pointer left or right from the bottom of that rounded rectangle frame?
\startuseMPgraphic{speechbubble} z1 = (0,0) ; z2 = (OverlayWidth,0) ; z3 = (OverlayWidth,OverlayHeight) ; z4 = (0,OverlayHeight) ; 1/2[x1,x2] = x8 + 2cm = x7 + 1cm = x9 - 1cm ; y7 = y9 = 0cm ; y8 = -2cm ; path p ; p = z1--z7--z8--z9--z2--z3--z4--cycle ; fill p withcolor blue ; draw p withpen pencircle scaled 5 ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineoverlay[speechbubble][\useMPgraphic{speechbubble}] \starttext \framedtext[frame=off,background=speechbubble]{\input ward } \blank[4cm] \framedtext[frame=off,background=speechbubble,width=6cm]{\input ward } \stoptext Wolfgang
Thanks Wolfgang.. In case there are any others who are in need.. Here is one with curvy speech bubbles, left and right, and wrapped up so they don't overhang any text. __ \startuseMPgraphic{speechL} z1 = (0.25cm,0) ; z2=(1 cm,0) ; z3 = (0,-1cm) ; z4 = (2cm,0);z5 = (OverlayWidth-0.25cm,0) ; z6 = (OverlayWidth,0.25cm) ; z7 = (OverlayWidth,OverlayHeight-0.25cm) ; z8 = (OverlayWidth-0.25cm,OverlayHeight) ; z9 = (0.25 cm,OverlayHeight);z10=(0,OverlayHeight-0.25cm) ; z11=(0,0.25cm) ; path p ; p = z1--z2{down}..{dir 270}z3{dir 30}..{dir 70}z4--z5{right}..{up}z6--z7{up}..{left}z8--z9{left}..{down}z10--z11{down}..{right}z1--cycle ; fill p withcolor blue ; draw p withpen pencircle scaled 1 ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \startuseMPgraphic{speechR} z1 = (0.25cm,0) ; z2=(5 cm,0) ; z3 = (7cm,-1cm) ; z4 = (6cm,0);z5 = (OverlayWidth-0.25cm,0) ; z6 = (OverlayWidth,0.25cm) ; z7 = (OverlayWidth,OverlayHeight-0.25cm) ; z8 = (OverlayWidth-0.25cm,OverlayHeight) ; z9 = (0.25 cm,OverlayHeight);z10=(0,OverlayHeight-0.25cm) ; z11=(0,0.25cm) ; path p ; p = z1{left}..{up}z11--z10{up}..{right}z9--z8{right}..{down}z7--z6{down}..{left}z5--z4{down}..{dir 270}z3{dir 150}..{dir 110}z2--cycle ; fill p withcolor blue ; draw p withpen pencircle scaled 1 ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineoverlay[speechL][\useMPgraphic{speechL}] \define [1] \speechbubbleL {\blank \framedtext[frame=off,background=speechL, width=7cm]{#1} \blank[1 cm]}] \defineoverlay[speechR][\useMPgraphic{speechR}] \define [1] \speechbubbleR {\blank \framedtext[frame=off,background=speechR, width=7cm]{#1} \blank[1 cm]}] \starttext Some text \speechbubbleL {'Who needs highlighter pens, anyway?'} If all three are satisfied then then sound radiates from the source to the detector. The source-medium-detector model was central to the model of sound. The vibrations, because of their nature, travel as variations in physical density, so rely on a medium made of particles connecting the source to the detector. Other vibrations, very similar in nature, could still travel out from the source, but not be detected. \speechbubbleR {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.} More and more dog latin for beginners.. And so on...... And so on \stoptext __ Sorry the metapost is not parameterised...I should have variables in to set up the offsets and curvature of the corners. But I have not go that far yet...my floor is only a little higher, thanks to Wolfgang. On 3 Feb 2011, at 08:39, Wolfgang Schuster wrote:
Am 02.02.2011 um 18:12 schrieb Ian Lawrence:
Evening all:
Has anyone got a nicer \speechbubble definition up their sleeve?
Here is not-nice one, so you know the floor:
\define [1] \speechBubble {\blank \framed [width=.6\textwidth ,autowidth=force,align={flushleft}, background=color, backgroundcolor=darkblue, foreground=color, foregroundcolor=white, frame=off,corner=0,backgroundoffset=5pt,] {#1} ~~~ \tfd \startcolor[darkblue]{'} \stopcolor \tfa \blank}
Called with things like:
\speechBubble {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.}
I guess there are some people with xs metapost skills out there... But is there as simple way to get a nice curved pointer left or right from the bottom of that rounded rectangle frame?
\startuseMPgraphic{speechbubble} z1 = (0,0) ; z2 = (OverlayWidth,0) ; z3 = (OverlayWidth,OverlayHeight) ; z4 = (0,OverlayHeight) ; 1/2[x1,x2] = x8 + 2cm = x7 + 1cm = x9 - 1cm ; y7 = y9 = 0cm ; y8 = -2cm ; path p ; p = z1--z7--z8--z9--z2--z3--z4--cycle ; fill p withcolor blue ; draw p withpen pencircle scaled 5 ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic
\defineoverlay[speechbubble][\useMPgraphic{speechbubble}]
\starttext
\framedtext[frame=off,background=speechbubble]{\input ward }
\blank[4cm]
\framedtext[frame=off,background=speechbubble,width=6cm]{\input ward }
\stoptext
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Am 3.2.2011 schrieb Wolfgang Schuster:
Am 03.02.2011 um 18:38 schrieb Philipp A.:
for the record: the TikZ package has built-in parameterized speech bubbles. Can you make a example?
Wolfgang
of course. you can read about it in the pgfmanual in chapter 39.7: \usepackage[tikz] \usetikzlibrary[shapes.callout] \starttext \starttikzpicture \node[ellips callout, draw] {Hallo!}; \stoptikzpicture \stoptext using the options callout relative pointer=(coordinate) and callout absolute pointer=(coordinate), you can modify where it points to, using standard node options you can modify other aspects (positioning, padding, width, height, color, line thickness, …) beware: i have not tested above code, but it should be obvious. Philipp
Am 08.02.2011 um 13:09 schrieb Philipp A.:
@wolfgang: was my example helpful?
Your example doesn’t work and I’m not interested to look into the manual how to fix it. MetaPost’s advantage (with mkiv) is that it’s faster than tikz. What’s is a library with a collection of shapes like tikz has. Wolfgang
Am 08.02.2011 um 17:08 schrieb Andreas Harder:
This worked for me.
Thanks, i wrapped it in a environment. \usemodule[tikz,annotation] \usetikzlibrary[shapes.callouts] \define[2]\SpeechbubbleCommand {\starttikzpicture[remember picture] \node[rectangle callout, draw] (node:ref) {\framedtext[width=fit,frame=off]{#2}}; \stoptikzpicture} \defineannotation [speechbubble] [alternative=command, command=\SpeechbubbleCommand] \starttext \speechbubble{Hello!} \startspeechbubble \input ward \stopspeechbubble \stoptext Wolfgang
Hi Wolfgang, Just out of curiosity I tested your example file, but mkiv stops upon ! Undefined control sequence. l.16 \defineannotation The version I have is ConTeXt ver: 2011.02.05 11:37 MKIV. Best regards: OK On 8 févr. 2011, at 17:38, Wolfgang Schuster wrote:
Am 08.02.2011 um 17:08 schrieb Andreas Harder:
This worked for me.
Thanks, i wrapped it in a environment.
\usemodule[tikz,annotation] \usetikzlibrary[shapes.callouts]
\define[2]\SpeechbubbleCommand {\starttikzpicture[remember picture] \node[rectangle callout, draw] (node:ref) {\framedtext[width=fit,frame=off]{#2}}; \stoptikzpicture}
\defineannotation [speechbubble] [alternative=command, command=\SpeechbubbleCommand]
\starttext
\speechbubble{Hello!}
\startspeechbubble \input ward \stopspeechbubble
\stoptext
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
%%%%%%%%%%%%%%%%%% Otared Kavian Département de Mathématiques Université de Versailles Saint-Quentin Bâtiment Fermat 45 avenue des Etats Unis 78035 Versailles cedex Téléphone: +33 1 39 25 46 42 Secrétariat: +33 1 39 25 46 44 Secrétariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr
Am 08.02.2011 um 21:06 schrieb Otared Kavian:
Hi Wolfgang,
Just out of curiosity I tested your example file, but mkiv stops upon ! Undefined control sequence. l.16 \defineannotation The version I have is ConTeXt ver: 2011.02.05 11:37 MKIV.
Please update your installation, the annotation module was added on Sunday to the minimals. I’ll add documentation later but you can take a look at the examples at my bitbucket site [1]. [1] https://bitbucket.org/wolfs/annotation/src Wolfgang
Hi Wolfgang, Yes, with the latest beta your example works fine. Many thanks and best regards: OK On 8 févr. 2011, at 21:14, Wolfgang Schuster wrote:
Am 08.02.2011 um 21:06 schrieb Otared Kavian:
Hi Wolfgang,
Just out of curiosity I tested your example file, but mkiv stops upon ! Undefined control sequence. l.16 \defineannotation The version I have is ConTeXt ver: 2011.02.05 11:37 MKIV.
Please update your installation, the annotation module was added on Sunday to the minimals. I’ll add documentation later but you can take a look at the examples at my bitbucket site [1].
[1] https://bitbucket.org/wolfs/annotation/src
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
%%%%%%%%%%%%%%%%%% Otared Kavian Département de Mathématiques Université de Versailles Saint-Quentin Bâtiment Fermat 45 avenue des Etats Unis 78035 Versailles cedex Téléphone: +33 1 39 25 46 42 Secrétariat: +33 1 39 25 46 44 Secrétariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr
Hi Andreas and Wolfgang, I wikified both your examples for future reference: http://wiki.contextgarden.net/speech_bubble (But unfortunatley I don't know how to add the PDF results of the TeX codes, but I don't think this is of importance). Best regards: OK On 8 févr. 2011, at 17:08, Andreas Harder wrote:
Am 08.02.2011 um 16:44 schrieb Wolfgang Schuster:
Am 08.02.2011 um 13:09 schrieb Philipp A.:
@wolfgang: was my example helpful?
Your example doesn’t work and I’m not interested to look into the manual how to fix it.
This worked for me.
Greeting Andreas___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Am 10.02.2011 um 11:23 schrieb Otared Kavian:
Hi Andreas and Wolfgang,
I wikified both your examples for future reference: http://wiki.contextgarden.net/speech_bubble (But unfortunatley I don't know how to add the PDF results of the TeX codes, but I don't think this is of importance).
You have to make a picture which you can then upload to the wiki. Wolfgang
participants (5)
-
Andreas Harder
-
Ian Lawrence
-
Otared Kavian
-
Philipp A.
-
Wolfgang Schuster