7

I want to accomplish this effect with LaTeX:

enter image description here

I have a slight idea of how to do that using \left{ and \right} on math mode but I’m not sure. If there’s a package that helps to do that, coding would be much easier and code would be much more beautiful.

4

another possibility is to use the array environment:

He is being
{\arraycolsep=0pt $\left\{
 \begin{array}{l} \mbox{a nuisance}\\ \mbox{naughty} \end{array}
 \right\}$}
again.

the \arraycolsep has to be localized, otherwise it will apply to the entire document from that point on. if you are already using the amsmath package, you can use \text instead of \mbox.

|improve this answer|||||
5

Fairly simple

\documentclass[a4paper]{memoir}
\begin{document}
He is being $\left\{\parbox{4.5em}{a nuisance\\nauggty}\right\}$ again
\end{document}

memoir is not relevant, just the default class in my editor

|improve this answer|||||
3

I would write something like this:

\documentclass{article}
\makeatletter
\def\multilines#1{$\left\{\vcenter{\vbox{\parse@arg#1\\\parse@arg\@nil}}\right\}$}
\def\parse@arg#1\\#2\@nil{\hbox{#1}\ifx\parse@arg#2\else\def\next{\parse@arg#2\@nil}\expandafter\next\fi}
\makeatother
\begin{document}
He is being \multilines{a nuisance\\naughty} again.

\TeX{} is \multilines{great\\powerful\\sooo easy}.
\end{document}
|improve this answer|||||
3

Here's two TikZ solutions!

TikZ bracketing text

And here's the code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{decorations.pathreplacing}

\newcommand{\bracketwrap}[2][]{%
\tikz[baseline=0pt] \node[anchor=east,align=left,left delimiter=\{,right delimiter=\},#1] (a) at (0,.5ex) {#2};}

\newcommand{\altbracketwrap}[2][]{%
\tikz[baseline=0pt] {\node[anchor=east,align=left,#1] (a) at (0,.5ex) {#2}; \draw[line width=1pt,decorate,decoration={brace,amplitude=4},line cap=round] (a.north east) -- (a.south east); \draw[line width=1pt,decorate,decoration={brace,amplitude=4},line cap=round] (a.south west) -- (a.north west);}}


\begin{document}

He is being \bracketwrap{a nuisance\\naughty} again

He is being \bracketwrap[inner sep=0pt]{a nuisance\\naughty} again

He is being \bracketwrap[inner sep=10pt]{a nuisance\\naughty} again

He is being \bracketwrap[text=red]{a nuisance\\naughty} again

He is being \bracketwrap[align=center]{a nuisance\\naughty} again

He is being \bracketwrap[align=right]{a nuisance\\naughty} again

He is being \altbracketwrap{a nuisance\\naughty} again

He is being \altbracketwrap[inner sep=0pt]{a nuisance\\naughty} again

He is being \altbracketwrap[inner sep=10pt]{a nuisance\\naughty} again

He is being \altbracketwrap[text=red]{a nuisance\\naughty} again

He is being \altbracketwrap[align=center]{a nuisance\\naughty} again

He is being \altbracketwrap[align=right]{a nuisance\\naughty} again

\end{document}

The matrix library in TikZ defines a couple of keys left delimiter and right delimiter which specify left and right delimiters. These can be applied to almost any node, not just matrices. The first set of examples uses these.

However, I find that sometimes I can see the pieces that the extensible braces are made from (look at the third example of the image above), so the second set actually draws the braces using the decorations.pathreplacing library. You lose the nice tapering at the ends and middle of the braces, but at least the braces are continuous.

|improve this answer|||||
2

A bit late to the party, but:

\documentclass{minimal}
\newcommand{\options}[1]
{\(\left\{\mbox{%
    \begin{tabular}{@{}l@{}}
        #1
    \end{tabular}}%
\right\}\)}
\begin{document}
He is being $\left\{\mbox{\begin{tabular}{@{}l@{}} a nuisance \\ naughty
\end{tabular}}\right\}$ again.

It can be used with \options{ more \\ many \\ lots of }
alternatives!
\end{document}

Uses tabular inside mbox, inside display-math containing auto-sizing brackets. I used @{}l@{} as column specifier, to suppress some spacing.

|improve this answer|||||

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.