NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
frabjous wrote:Can you just use the framed environment from the framed package? Or the Sbox environment of fancybox?
For this example, yes, but what I actually want is a lot more complicated. I just wanted the example to be quickly understood for anyone reading this forum.
Edit: I suppose using the framed environment would work as well, as long as the functionality is identical to fbox, but I'd still like to know if the scenario in the OP is possible.
kostka wrote:[...] I suppose using the framed environment would work as well, as long as the functionality is identical to fbox, but I'd still like to know if the scenario in the OP is possible.
Don't suppose, just test. The framed package as suggested by frabjousis the solution to your scenario. But for emphasized equations the empheq package from the mh bundle is better.
kostka wrote:[...] I suppose using the framed environment would work as well, as long as the functionality is identical to fbox, but I'd still like to know if the scenario in the OP is possible.
Don't suppose, just test. The framed package as suggested by frabjousis the solution to your scenario. But for emphasized equations the empheq package from the mh bundle is better.
Best regards
Thorsten
Thanks for mentioning the empheq package, which I was not aware of.
Anyhow, the framed environment does not seem to work as 1) it resets the paragraph indentation for the next line, even if no space is skipped and 2) it adds too much space (though this point can likely be fixed).
The empheq package doesn't seem to be able to box both the equation and its number, which is what I'm after.
kostka wrote:I'm going to mark this topic as solved, but I'm still surprised there isn't an easy way to use unbalanced brackets inside of an argument.
It's a syntactic problem: The \newenvironment command needs to know where its arguments end, and allowing unbalanced braces would result in ambiguities.
It is possible to grab the contents of an environment as a macro parameter (in fact, this is done by most of the amsmath environments), but generally you should rely on packages that provide a higher level abstraction.
Something that is always possible and requires no tricks is grabbing the contents in a LR box using the lrbox environment:
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p