7

I'm looking for an automatic fence-resizing macro like the traditional \left and \right, but I need some more features (not to mention \left and \right are quite "buggy" and poorly spaced as the consensus seems to be). In particular, I would like the ability to

  • exclude certain parts of the formulas from being counted (typically sub/superscripts) and
  • to break a fenced section across a linebreak while ensuring the sizes remain the same

I noticed that the nath package provides the features but it dramatically changes the rest of the math syntax in ways that are incompatible with "standard" LaTeX, which means they are prone to breakage when other packages are used.

Does anyone have a more lightweight solution to this problem?

  • 8
    breqn is the other main contender in this area but no solution will be lightweight, any solution will have to redefine almost everything and so potentially be incompatible with all existing packages for math layout. – David Carlisle Oct 20 '13 at 09:36
  • Hrm I see. Well I appreciate the info on this though. – Rufflewind Oct 22 '13 at 02:22

1 Answers1

3

This uses features of the beta version of my tabstackengine package (see Writing a table with equally spaced columns, based on the widest column) to be able to preserve the height of the item across rows. However, it cannot automatically shield out things like subscripts, etc. It takes an optional argument on how to align the two rows of the split equation.

It is set to, by default, use the & character to define the split point.

\documentclass{article}
\usepackage{tabstackengine}[2013-10-21]
\usepackage{scalerel}
\TABMath
\newcommand\breq[2][c]{%
  \def\stackalignment{#1}
  \readTABrow{i}{#2}%
  \stackunder{%
    \scalerel[1.5ex]{\{}{\TABcell{i}{1}\TABstrut{i}}%
  }{%
    \TABcell{i}{2}%
    \scalerel*[1.5ex]{\}}{\TABcell{i}{2}\TABstrut{i}}%
  }
}
\begin{document}
\[
y = \breq[r]{\displaystyle\frac{x^2 + x + 3}{y_2} & -x}
\]
\end{document}

enter image description here

  • That's pretty neat. Do you think there is a way to make use of the code in http://tex.stackexchange.com/questions/23161 to implement the "hiding" mechanism? – Rufflewind Oct 22 '13 at 05:54
  • @fzlogic I can't think of a way to do the hiding mechanism selectively, but I'll keep mulling it over.... – Steven B. Segletes Oct 22 '13 at 10:17