Math expression or variable in text area ?

Math expression or variable in text area ? - How do I........ - Messages

#1 Posted: 3/26/2019 5:31:48 AM
Peter J Francis

Peter J Francis

0 likes in 18 posts.

Group: User

Hi all,
I'm trying to construct a block of text as a summary to a worksheet.
I want to include some of the calculated values (and their UoM).

Previously I've done this by padding the text with spaces and putting the variable 'over' the space.
This works to a certain extent but it can look a little scruffy as I have to leave space incase the varible is long.

All suggestions are welcome

Regards

Peter J Francis
Thermal Design Consultants Ltd
Thermal-Design.Net

Peter J Francis Twitter: @PeterJFrancis Thermal Engineer , Maker , Pilot
#2 Posted: 3/26/2019 6:09:07 AM
sergio

sergio

115 likes in 329 posts.

Group: User

You can use "Writer Region" plugin by Davide Carpi.
With the command CTRL + SHIFT + M (or the Edit Marh icon) and pasting into, the mathematical expression that you previously copied from a mathematical area.

sergio
#3 Posted: 3/26/2019 9:24:23 AM
Peter J Francis

Peter J Francis

0 likes in 18 posts.

Group: User

Hi Sergio,
Unfortunatley "Writer Region" doesn't evaluate the formula it just displays it.

I'll continue searching for a solution , if I find one I'll post it here

Thanks

Peter
Peter J Francis Twitter: @PeterJFrancis Thermal Engineer , Maker , Pilot
#4 Posted: 3/26/2019 9:57:46 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Hi Peter. This helps?: https://en.smath.com/forum/yaf_postst2060_Snapshot-Region.aspx

Actually, MS Excel have a similar function: paste as linked image. I use this for show summaries in excel.

Best regards.
Alvaro.
#5 Posted: 3/26/2019 10:50:31 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I'm trying to construct a block of text as a summary to a worksheet.
I want to include some of the calculated values (and their UoM).


Smath is ultimate for best publishing in several preferences.
As a summary, insert the text and the maths in an image region.
Done SS 6179 ... if red => report.
In short: Smath is equivalent/superior to maths book style.

Jean

Image Formated LABEL examples Martin Bar.sm (31 KiB) downloaded 105 time(s).
#6 Posted: 3/10/2022 11:24:24 AM
Mr. Whiskers

Mr. Whiskers

0 likes in 6 posts.

Group: User

Sorry to resurrect this thread, but I recently found what I think is the solution and wanted to post it here since this thread is the first result on Google for this question:

Here are the steps I follow to embed live variables into a text field:
  1. Click anywhere in empty space on the worksheet
  2. Press 'Shift+"' as if you are typing an open quotation mark. This starts a text field.
  3. Type some placeholder text with a space in between two words, like "test test"
  4. Go to the variable that you want to insert into the text field and make sure it is evaluated, i.e. it shows an equal sign after it with some valid value & units. For example, I might evaluate the variable Vin such that it appears as "Vin = 5V" in the worksheet.
  5. Now, highlight the entire contents of that variable field (Vin = 5V) and copy it (CTRL + C)
  6. Now, go back to the text field you created in step 2 and place your cursor in the middle of the two words "test" and "test". In that place, paste (CTRL + V) the variable that you just copied.
  7. At this point, you should have a live variable that is evaluated in the middle of your text field. The evaluated result and units may be unexpected, so just delete the result and the "=" sign, then re-type the = sign to get the correct format of your answer and units.
Step 5 is critical that you copy a variable that is already evaluated in full with equal sign, result, and units (if applicable). Otherwise, if you just copy the variable name and paste it into the text field, SMath will convert that variable to simple text, as I'm sure you have experienced.

Let me know if there are questions or if these steps don't work for people. I'm curious if there are corner cases where this trick does not work, as I've only tried it thus far with very simple variables and units.

Edit: Here are two screenshots of the live variable in action. The first shows how the text field with embedded variable appears normally, and the second shows them highlighted to demonstrate the variable is truly embedded into the text field.

SMath Variable in text field 1.png
SMath Variable in text field 2.png
#7 Posted: 3/12/2022 3:40:59 AM
overlord

overlord

549 likes in 1332 posts.

Group: Moderator

Wrote

Let me know if there are questions or if these steps don't work for people.


The steps above work, nothing is wrong with those items.
And now there is a simpler way to write formulas in text regions.

If equation replacement is enabled for that particular text region,
you can insert > formula and directly write anything math involded.
And it will be evaluated and changed according to variable value.

So you won't need to copy/paste everything.

Regards

replacement.png

formula.png
2 users liked this post
sergio 3/12/2022 5:30:00 AM, João Felipe Seráfico Melo 3/12/2022 1:58:00 PM
#8 Posted: 3/12/2022 12:10:16 PM
Mr. Whiskers

Mr. Whiskers

0 likes in 6 posts.

Group: User

Excellent, thank you overlord!
#9 Posted: 3/12/2022 1:59:12 PM
João Felipe Seráfico Melo

João Felipe Seráfico Melo

7 likes in 62 posts.

Group: User

That feature is amazing! For how long has it been available? Brand new stuff for me.
  • New Posts New Posts
  • No New Posts No New Posts