# how to position an anchor in this bubble?

the code below is part of a class I am making, I am posting the relevant part to my question. my problem is not the bubble itself, but rather the

here the chat class name it "chat.cl"

\ProvidesClass{chat}
\makeatletter

\usepackage{varwidth}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage[top=1in,         bottom=1in,
right=0.5in,      left=0.5in,
paperwidth=8.3in,paperheight=11.7in]{geometry}
\usepackage{multicol}

\pagestyle{empty}
\setmainfont{DroidSans}
\setlength{\parindent}{0pt}

\usepackage{xcolor}
\definecolor{backgroundgray}{RGB}{238,238,238}
\definecolor{linegray}{RGB}{212,212,212}
\definecolor{circgray}{RGB}{199,199,199}
\definecolor{msggreen}{RGB}{18, 137, 254}
\definecolor{kiktimepalegray}{RGB}{158,169,184}
\definecolor{kiktimedarkgray}{RGB}{122,133,151}
\definecolor{white}{RGB}{229, 229, 234}
\definecolor{snow}{RGB}{255,255,255}
\def\@hours{12}
\def\@minutes{11}
\def\@partnerName{Sample Name}

\def\@drawBackground{
\begin{tikzpicture}[remember picture, overlay]

\end{tikzpicture}
}

\usepackage{everypage}

\def\setPartnerName#1{
\def\@partnerName{#1}
}

\def\setPartnerPic#1{
\def\@partnerPic{#1}
}

\def\setHours#1{
\def\@hours{#1}
}

\def\setMinutes#1{
\def\@minutes{#1}
}

\def\me#1{
\hphantom{.}\hfill\begin{tikzpicture}
\color{snow}
\draw (0,0) node[anchor=north east,rectangle,rounded corners=5,fill=msggreen, scale=0.75] {
\hspace{.1in}\begin{varwidth}{2.5in}
\vphantom{.}
\raggedright #1\\
\tiny \color{msggreen}.
\end{varwidth}
\hspace{.1in}
};
\fill[msggreen] (-0.01in,-0.06in) -- (0.06in,-0.12in) -- (-0.01in,-0.18in) -- cycle;
\end{tikzpicture}
\vspace{.01in}\\
}

\def\you#1{
\begin{tikzpicture}
\ifdefined\@partnerPic
\draw (-.6,-.3) node[scale=1.825,circle, path picture={
\node at (path picture bounding box.center){
\includegraphics[width=.24in]{\@partnerPic}
};
}
] {};
\else\fill[black] (-.6,-.3) circle (.12in);\fi
\draw (0,0) node[anchor=north west,rectangle,rounded corners=5,fill=white, scale=0.75] {
\hspace{.1in}\begin{varwidth}[c]{2.5in}
\vphantom{.}
\raggedright #1\\
\tiny \color{white}.
\end{varwidth}
\hspace{.1in}
};
\fill[white] (0.01in,-0.06in) -- (-0.06in,-0.12in) -- (0.01in,-0.18in) -- cycle;
\end{tikzpicture}
\vspace{.05in}\\
}

\def\time#1#2{
\hphantom{.}\hfil\begin{tikzpicture}
\draw (0,0) node[scale=.65] {\color{kiktimepalegray}#1 \color{kiktimedarkgray}@ #2};
\end{tikzpicture}\hfil\\
}

\makeatother


here is a sample invoking chat class (chat.tex)

\documentclass{chat}
\setPartnerName{John doe}
\setPartnerPic{nature.jpg}
\setHours{12}
\setMinutes{11}
\newcommand{\mylipsum}{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation }
\begin{document}
\begin{multicols}{2}
\me{\mylipsum }
\time{Fri}{1:03 PM}
\you{\mylipsum }
\me{\mylipsum}
\you{\mylipsum }
\end{multicols}
\end{document}


Than "anchor= north east" block produce something like this

while I want it to be like this - don't mind the location, I am only concerned with the shape.

the desired one is pleasantly easy with CSS, but cannot make it happen in latex. if it helps with the format (coordinates), here is the CSS part

p.set::after {
content: "";
position: absolute;
right: -0.5em;
bottom: 0;
width: 0.5em;
height: 1em;
border-left: 0.5em solid #1289fe;
}

• Would be much better if you made a complete example that we can compile without modifying anything. Makes it a lot easier to test. – Torbjørn T. Sep 29 '17 at 18:15
• I will edit it now, with the class and sample – Katherin Romanova Sep 29 '17 at 19:46
• edited with a complete example, and class – Katherin Romanova Sep 29 '17 at 19:50

So you're after something like this? (Ignore the font.)

Below are the definitions of \me and \you that were used. The part used to draw the "arrow" is for \me the following:

\fill[msggreen] ([yshift=-5pt,xshift=-\pgflinewidth]me.north east) to[bend right=15] ++(3mm,-3mm) to[bend left] ++(-3mm,1mm) --cycle;


The me comes from having given the node a name, note \node [..] (me) ... in the code. So the first coordinate is 5pt below, and the standard line width left, of the top right corner of the node. Then we draw a curved line (bend right=15, the number indicates angle I think) to the point the is 3mm right and 3mm below the first point (the ++ indicates that the coordinate is relative to the previous one). Then we go back, 3mm left but only 1mm up, and again draw a curved line. The definition for \you follows the same concept.

Change the coordinates and values for bend left/bend right to modify the shape.

\def\me#1{
\hphantom{.}\hfill\begin{tikzpicture}
\color{snow}
\node[rectangle,rounded corners=5,fill=msggreen, scale=0.75] (me) {
\hspace{.1in}\begin{varwidth}{2.5in}
\vphantom{.}
\raggedright #1\\
\tiny \color{msggreen}.
\end{varwidth}
\hspace{.1in}
};
\fill[msggreen] ([yshift=-5pt,xshift=-\pgflinewidth]me.north east) to[bend right=15] ++(3mm,-3mm) to[bend left] ++(-3mm,1mm) --cycle;
\end{tikzpicture}
\vspace{.01in}\\
}

\def\you#1{
\begin{tikzpicture}
\node[anchor=north west,rectangle,rounded corners=5,fill=white, scale=0.75] (you) {
\hspace{.1in}\begin{varwidth}[c]{2.5in}
\vphantom{.}
\raggedright #1\\
\tiny \color{white}.
\end{varwidth}
\hspace{.1in}
};
\fill[white] ([yshift=-5pt,xshift=\pgflinewidth]you.north west) to[bend left=15] ++(-3mm,-3mm) coordinate (arrow) to[bend right] ++(3mm,1mm) -- cycle;

\ifdefined\@partnerPic
\node[scale=1.825,circle, path picture={
\node at (path picture bounding box.center){
\includegraphics[width=.24in]{\@partnerPic}
};
}
] at ([xshift=-0.13in]arrow) {};
\else\fill[black] ([xshift=-0.13in]arrow) circle (.12in);\fi
\end{tikzpicture}
\vspace{.05in}\\
}

• Amazing! YES YES! That is exactly what I am looking for. Thank you.. now I will tinker around to fit my needs. Thank you again for concise and prompt answer – Katherin Romanova Sep 29 '17 at 20:45