2

I want to encapsulate text in a sort of inline "dialogue bubble". To do this I defined

% overline text 
\newcommand{\textoverline}[1]{$\overline{\mbox{#1}}$}

as seen here, and defined my dialogue box as

% dialogue box
\newcommand{\Say}[1]{%
  \textless(\underline{\textoverline{``{#1}''}})
}

which ends up looking like this:

dialogue box attempt

I was wondering how to match the under- and overlines to the encapsulating parentheses, and how to extend the lines a bit to overlap more with the parentheses. I looked into using the soul package but couldn't get it to work correctly :/

ADDITION: How can I have it wrap text automatically?

Thanks!

4

there are probably easier ways to do this, but here's a possibility.

\documentclass[12pt]{article}
\usepackage{amsmath}

\newcommand{\textbubble}[1]{%
  \ensuremath{\bigl(\text{$\underline{\overline{\mathstrut
    \smash{\text{#1}}}}$}\bigr)}}

\begin{document}

$\bigl(\text{$\underline{\overline{\mathstrut
  \smash{\text{``Test text''}}}}$}\bigr)$

\textbubble{Sample text}

\end{document}

output of example code

i've used amsmath and \text here instead of \mbox because \mbox forces the space for the argument to be both higher and deeper. \mathstrut is defined to be exactly the height of a parenthesis.

this won't break across lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.