I would like to create an inline brace command \inline{}
for xelatex
using TikZ
. The difficult part is calculating the text width for the node without hardcoding it into the tikzpicture
environment.
I would like:
- VARIABLE 1 Text width = Length of the Longest Word within node
e.g.
\node[decoration={brace},decoration,text centered,text width=VARIABLE1,]
- VARIABLE 2 Distance of brace from node to be the length of the longest word plus a little extra space for aesthetics. e.g.
\p1=(bracetext.north), \p2=(bracetext.south) in ($(\x1+VARIABLE2,\y1)$) -- ($(\x2+VARIABLE2,\y2)$);
- Ideally the baseline of the node will be aligned such that the pointy part of the braces are aligned with the lines of the sentence (also for aesthetics).
\documentclass[handout]{beamer}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{chains,calc,trees,positioning,arrows,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols}
\tikzset{%
decoright/.style={decoration={brace},decorate},
decoleft/.style={decoration={brace,mirror},decorate},
}
\newcommand{\inbrace}[1]{%
\tikz{
\node[decoration={brace},decoration,text centered,text width=3cm,](bracetext){\small#1};
%\draw[decotop] (bracetext.north) to (bracetext.south);
\draw[decoright] let
\p1=(bracetext.north), \p2=(bracetext.south) in
($(\x1+2.5em,\y1)$) -- ($(\x2+2.5em,\y2)$);
\draw[decoleft] let
\p1=(bracetext.north), \p2=(bracetext.south) in
($(\x1-2.5em,\y1)$) -- ($(\x2-2.5em,\y2)$);
}%
}%
\begin{document}
\begin{frame}
\frametitle{Bound Morphemes versus Free Morphemes and Bound Roots}
A \inbrace{root\\stem\\base} is a morpheme, which is more specifically a lexeme, to which we can add other morphemes in the form of affixes. In most cases, we are connecting affixes to the front (prefix) or back (suffix) of a lexeme, however, occassionally there are instances when we add them within a lexeme (infix).
\end{frame}
\end{document}
Sample Output:
multipart
node. Regarding the item 3 you can use\tikz[baseline=....]
for adjusting the position where the picture meets the line. With all respect, it will never look good if you insist on inline version. – percusse Apr 16 '13 at 18:57multipart
node is and I will have to read up on that. I did have a failed baseline attempt and I should have included that in my code and examples. Inline tikz is pretty important for flexibility. I think it will always look better than anything Powerpoint or Word could produce—though I am not sure what you mean here. It would be useful to have the baseline also calculated based on how many words are within the node. – Jonathan Komar Apr 16 '13 at 19:03