How do you create a formula with multiple options

I’m trying to create something that looks like (in 3 lines)

          | n/2
f(n) =    |
          | 3n +1

There is no formula option (Insert->formula) which seems to do what I want, so I tried to use normal paragraphs. I used a left border on the n/2 term and the 3n + 1 term, and a right border on the f(n) term. The left borders showed on the monitor, the right border did not.

So I have two questions: (1) is there a better way of doing what I want, and (2) why doesn’t the right border appear on my monitor?

You are all doing a great job. Thanks.

art

There is no formula option (Insert->formula)

Have you tried Insert -> Object -> Formula ?

Sorry. Quick fingers, slow mind. You are correct. I should have written: Insert->Object->Formula. And I did try that but did not see something I could use. I couldn’t see any multi-line separator which would allow three lines. I did see ‘divide’ which allowed me to do something like {n e N divide n > 0} which put a vertical line separator between the two terms.

f(n) = left lline ~ stack { n/2 # ~ # 3 n + 1 } right none

I used ~ to add spaces in the formula which is 3 lines high. If you prefer 2 lines, remove # ~.

You can also write:

f(n) = left lline ~ stack { n over 2 # ~ # 3 n + 1 } right none

The “bars” are offered in the Brackets menu item and stacking in Formats.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

@ostbits: Just some explaining and a bit of elaboration to show your additional options here:

  • Braces are often useful in a complex formula, to group the elements
  • Alignment modifiers can be used to adjust layout. They are alignl, alignc and alignr. You can use them on multiple group levels
  • A wide brace is often used (perhaps more in older texts) where you have the vertical bar.
  • The left and right keywords specify that “the following token is used for bracketing”, and they are also modifiers that make the bracketing character stretch to cover the full heigth of the bracketed expression.

Using those, you can get this adjusted version of @ajlittoz’ suggestion:

f(n) = left lbrace ~ stack {alignl {{alignc n} over {alignc 2}} # ~ # alignl{3 n + 1} } right none

Did I ever say you are awesome? Thanks all Is there are reference to the “formula language”? Is the failure to show the right border in my example a bug?

Difficult to answer (2) without a sample file.

Finally got the borders working. But I’m going to use the ‘formula’ suggestions instead, and working is relative.

thanks