I would like use stretchable square brackets outside of a math environment. Ideally, I would like to use \left[ blah \right.
right in my text.
Is it possible ? How ?
Note : I would like to be able to include new environment in place of my "blah", like this :
\left[
\begin{array}{l}
blah \\
blah
\end{array}
\right.
Example #1 :
Best Answer
Here's another solution using TiKZ which gets you a look more or less as you describe.
Preamble
These definitions define macros to produce code blocks, which have a uniformly customizable delimiter on the left. Each distinct line of code, or code block, should be ended with an end-of-line. We define the
\IF
and\ELSE
block in terms of a generic code block, which starts off (and conceivably ends, as well) with some label aligned with the top of the delimiter. You could use similar code to define a repeat ... until code block, or a procedure ... return block. The various dimensions were picked more or less arbitrarily, except for the cases of0.5\baselineskip
.Document body
As it's currently defined,
\BEGIN ... \END
will complain if there's a blank line. There are a few ways to get around that (e.g. simply by using different syntax); I've written it in this way instead to keep things simpler and to emulate some of the syntax for existing algorithm/pseudocode packages.Result
Edit the code (e.g. remove the "end" in the definition of
\ELSE
) and define other blocks (perhaps things like\FOR
and\WHILE
) to get the sort of algorithm presentation that you want.