文本周围有两个大括号

文本周围有两个大括号

又回来了!目前正在尝试双括号:其中单词 {para}{para} 单词都在一行上。我正在尝试玩弄代码。但我似乎无法让它工作。这是我的尝试。任何建议都非常感谢!

这是我之前在这里提出的类似问题,该问题的答案如下: 文本周围的大括号

想要实现的目标示例:

![](http://imgur.com/2LGQnoe)

  \documentclass[oldfontcommands,11pt]{memoir}
  % Page Layout
  \usepackage[margin=1in, paperwidth=8.5in, paperheight=11in]{geometry}%   http://ctan.org/pkg/geometry
  \usepackage{xparse}% http://ctan.org/pkg/xparse
  \usepackage{varwidth}% http://ctan.org/pkg/varwidth

  %% Dual Convo Bracket Command:
  \NewDocumentCommand{\dboxbrace}{s O{\{} O{\}} O{0.05\linewidth} m O{0.4\linewidth} m  }{% \lrboxbrace[<lbrace>][<rbrace>][<lwidth>]{<ltext>}[<rwidth>]{<rtext>}

    \begin{lrbox}{\leftlatbox}% Left Lateral box
      \IfBooleanTF{#1}% starred/unstarred
        {\begin{varwidth}{#4}#5\end{varwidth}}
        {\begin{minipage}{#4}#5\end{minipage}}
    \end{lrbox}
    \begin{lrbox}{\rightmedbox}% Right Medial box
      \IfBooleanTF{#1}% starred/unstarred
        {\begin{varwidth}{#6}#7\end{varwidth}}
        {\begin{minipage}{#6}#7\end{minipage}}
    \begin{lrbox}{\leftmedbox}% Left Medial box
      \IfBooleanTF{#1}% starred/unstarred
        {\begin{varwidth}{#4}#5\end{varwidth}}
        {\begin{minipage}{#4}#5\end{minipage}}
    \end{lrbox}
    \begin{lrbox}{\rightlatbox}% Right Lateral box
      \IfBooleanTF{#1}% starred/unstarred
        {\begin{varwidth}{#6}#7\end{varwidth}}
        {\begin{minipage}{#6}#7\end{minipage}}      
    \end{lrbox}
    \ensuremath{\usebox\leftlatbox\left#2\usebox\rightmedbox\right#3\left#2\usebox\leftmedbox\right#3\usebox\rightlatbox}
  }

    \begin{document}

    % Example of attempted use
         %% Example of dual Work
          \begin{center}
              \dboxbrace {word} {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed
    eleifend tincidunt enim, eu tincidunt felis auctor quis. Aenean eget
    enim urna.  Pellentesque tincidunt adipiscing velit a
    fermentum. \endgraf Lorem ipsum dolor sit amet, consectetur
    adipiscing elit. Sed eleifend tincidunt enim, eu tincidunt felis
    auctor quis. Aenean eget enim urna.  Pellentesque tincidunt
    adipiscing velit a fermentum.} {Lorem ipsum dolor sit amet, sectetur   adipiscing elit. Sed
    eleifend tincidunt enim, eu tincidunt felis auctor quis. Aenean eget
    enim urna.  Pellentesque tincidunt adipiscing velit a
    fermentum. \endgraf Lorem ipsum dolor sit amet, consectetur
    adipiscing elit. Sed eleifend tincidunt enim, eu tincidunt felis
    auctor quis. Aenean eget enim urna.  Pellentesque tincidunt
    adipiscing velit a fermentum.} {word}
                \end{center}
    \end{document}

答案1

使用完全不同的方法:

\documentclass{article}
\usepackage{scalerel}
\parskip 1em
\begin{document}

\def\mytext{blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah}

\def\lftmk{\{}
\def\rgtmk{\}}

word
\scaleleftright[2ex]{\lftmk}{\parbox{4cm}{\mytext}}{\rgtmk}
\scaleleftright[2ex]{\lftmk}{\parbox{4cm}{\mytext\mytext}}{\rgtmk}
word

\def\lftmk{(}
\def\rgtmk{)}

word
\scaleleftright[2ex]{\lftmk}{\parbox{4cm}{\mytext\mytext}}{\rgtmk}
\scaleleftright[2ex]{\lftmk}{\parbox{4cm}{\mytext}}{\rgtmk}
word

\end{document}

在此处输入图片描述

使用 scalerel,甚至不可调节的符号也可以用作分隔符,例如<>等。该scalerel包将对它们进行缩放。

答案2

下面是我为解决我的问题而编写的一段代码:一种解决方法,使用两个命令包装在一个 mbox 中以使其适合一行:尽情享受吧!

命令:

%Savebox:
\newsavebox{\leftbox} \newsavebox{\rightbox}
% Dual Convo Command:
 % Dual Left Command:
 \NewDocumentCommand{\ldboxbrace}{s O{\{} O{\}} O{0.04\linewidth} m O{0.38\linewidth} m}{% \lrboxbrace[<lbrace>][<rbrace>][<lwidth>]{<ltext>}[<rwidth>]{<rtext>}
 \begin{lrbox}{\leftbox}% Left box
 \IfBooleanTF{#1}% starred/unstarred
 {\begin{varwidth}{#4}#5\end{varwidth}}
 {\begin{minipage}{#4}#5\end{minipage}}
 \end{lrbox}
 \begin{lrbox}{\rightbox}% Right box
 \IfBooleanTF{#1}% starred/unstarred
 {\begin{varwidth}{#6}#7\end{varwidth}}
 {\begin{minipage}{#6}#7\end{minipage}}
 \end{lrbox}
 \ensuremath{\usebox\leftbox\left#2\,\usebox\rightbox\,\right#3}
 }
 % Dual Right Command:
 \NewDocumentCommand{\rdboxbrace}{s O{\{} O{\}} O{0.38\linewidth} m O{0.04\linewidth} m}{% \lrboxbrace[<lbrace>][<rbrace>][<lwidth>]{<ltext>}[<rwidth>]{<rtext>}

 \begin{lrbox}{\leftbox}% Left box
 \IfBooleanTF{#1}% starred/unstarred
 {\begin{varwidth}{#4}#5\end{varwidth}}
 {\begin{minipage}{#4}#5\end{minipage}}
 \end{lrbox}
 \begin{lrbox}{\rightbox}% Right box
 \IfBooleanTF{#1}% starred/unstarred
 {\begin{varwidth}{#6}#7\end{varwidth}}
 {\begin{minipage}{#6}#7\end{minipage}}
 \end{lrbox}
 \ensuremath{\left#2\usebox\leftbox\right#3\usebox\rightbox}
 }

例子:

\begin{center}
\mbox{
\ldboxbrace {abc} % The left bracket
    {Loren ipsum dolor sit amet, consectetur adipiscing elit. Sed
  eleifend tincidunt enim, eu tincidunt felis auctor quis. Aenean eget
  enim urna.  Pellentesque tincidunt adipiscing velit a
  fermentum. \endgraf Lorem ipsum dolor sit amet, consectetur
  adipiscing elit. Sed eleifend tincidunt enim, eu tincidunt felis
  auctor quis. Aenean eget enim urna.  Pellentesque tincidunt
  adipiscing velit a fermentum.}

\rdboxbrace  {Loren ipsum dolor sit amet, consectetur adipiscing elit. Sed
  eleifend tincidunt enim, eu tincidunt felis auctor quis. Aenean eget
  enim urna.  Pellentesque tincidunt adipiscing velit a
  fermentum. \endgraf Lorem ipsum dolor sit amet, consectetur
  adipiscing elit. Sed eleifend tincidunt enim, eu tincidunt felis
  auctor quis. Aenean eget enim urna.  Pellentesque tincidunt
  adipiscing velit a fermentum.} %The rigth bracket
  {abc}
  }
\end{center}

再次感谢大家。

答案3

\begin{array}{lll}
  (\cos(\theta) + i \sin(\theta))^n = \cos(n\theta)+i \sin(n\theta) \space & 
\mbox{where} &
   \left \{
   \begin{array}{lcr}
     \theta \in \mathbb{R} \\
     n \in \mathbb{Z}: n \geq 1 \\
   \end{array}
   \right \}
\end{array}

举个例子。

相关内容