# Signs dependent on answers in 'Advice' section

8 views

### Josh Oldridge

Jun 30, 2021, 5:15:21 AMJun 30
to Numbas Users

Hi,

Does anyone know if there is a way of making the signs between parts of an expression based on the next term? At the moment I have a + between each part of the answer (in red in the attached image), but this makes it look clunky when the answer is negative such as in the example, hence why I have brackets around. I tried putting a \simplify in front of the signs but couldn't work out how to get it working correctly. (The green terms are variable.)

Many thanks!

### Julia Goedecke

Jun 30, 2021, 5:29:30 AMJun 30
to Numbas Users
Hello,
Have you tried putting simplify around the whole expression?
Julia

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/320dcae8-5163-47bc-8e9a-c509187457a6n%40googlegroups.com.

### Christian Lawson-Perfect

Jun 30, 2021, 5:34:29 AMJun 30
Hi Josh,
\simplify is the right thing to use. In order for it to work, you need to write the whole expression inside \simplify.
Your problems with \simplify might be partly down to the hats on the letters. You can't use LaTeX inside \simplify, so you need to use name annotations to get the hats.

If the coefficients of x, y and z are variables named a, b, c, respectively, this would produce the output you want:

$\simplify{ {a}*hat:x + {b}*hat:y + {c}*hat:z }$

I hope that helps!

### Josh Oldridge

Jun 30, 2021, 5:34:50 AMJun 30
Hi Julia. I have, but it said this made it an invalid expression, I think maybe because of the \hat for x, y, and z.

On Wed, 30 Jun 2021 at 10:29, Julia Goedecke <julia.g...@cantab.net> wrote:
You received this message because you are subscribed to a topic in the Google Groups "Numbas Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/numbas-users/3uJUBoz8YCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/CAK1uihvzvsmASYx%3DPrfnRif%2Bs1-E2eP852BfQnvDNXSKYK%3D9Gw%40mail.gmail.com.

### Josh Oldridge

Jun 30, 2021, 5:59:41 AMJun 30
Thanks so much for creating that example, Christian. I still can't quite get it to work in my case. It appears fine in the preview thing (below), but then doesn't work with what I have. Could it be because the dxdy, dydx, dzdy, etc. variables I have are expressions based on a diff function? Or maybe I'm doing something else wrong. I can grant access if you like?

You received this message because you are subscribed to a topic in the Google Groups "Numbas Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/numbas-users/3uJUBoz8YCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/CAEMHSOiXwFVf-psOwckk9Qw6uefnqXCp3H9ecjNDLr%3DoREwjNg%40mail.gmail.com.