cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Translate the entire conversation x

Is it possible to use special characters in variable names?

JM_9969096
3-Newcomer

Is it possible to use special characters in variable names?

For all of Mathcad's reputation as being a primary math software, it's always a little frustrating that it can't seem to replicate and utilize the math notation commonly used in textbooks, reference books, etc. Many, many references will use special characters of some type in their variable names, but this seems to be next to impossible to replicate in Mathcad worksheets, so I have to use alternate naming for those variables, and then add text noting that this variable is really the one everyone is familiar with that uses a symbol in the variable name. For instance, when referencing stresses parallel and perpendicular to the plane of interest, it's not unusual to use a term like f‖ and f┴ to denote those. (See the screenshot below for how these are were supposed to look. They looked exactly like they were supposed to when I typed them, but then I hit "post" and the editor removed the "invalid HTML" [subscripts]) Anyway, symbols like that in the variable subscripts are common, clear, recognizable because that's how it's shown in authoritative references that we are often basing our worksheets on, and also only 1 character so already-long formulas don't get unmanageably long.
PTC claims that "Identifiers can contain any valid Unicode character from the Base Multilingual Plane (BMP) with the exception of white space and control characters, and with the additional limitation that the first character cannot be a decimal digit (0-9). Unicode BMP characters are defined as having a code in the range 0-65535." PTC also says that characters in that range can be copied and pasted from the Windows Character Map. The double vertical line, U+2016, representing "parallel to" is a Unicode character from the BMP. However, I can NOT get Mathcad 10 Prime to accept that as a subscript (or anything else) in a math region, only as text in the worksheet. It will not paste from Character Map. Am I correctly reading the Mathcad help topic to basically say that PTC says they can do something that they actually can't? Does anyone have any suggestions for how to input special characters like those in the attached screenshot? Is it just my bad memory, or didn't we have more abilities for stuff like this in the old days of Mathcad? Much thanks for any help.

6 REPLIES 6

Use 2byte codes.

image.png

Werner_E
25-Diamond I
(To:JM_9969096)


Am I correctly reading the Mathcad help topic to basically say that PTC says they can do something that they actually can't?

I would rather say that PTC does not tell you HOW to place these characters in variable names and that the procedure is anything but intuitive and simple.

 

To insert a character from Windows' charmap you start by typing double quotes as if creating a string constant. You then can copy characters from charmap into the string and at the end you delete the quotes and voilà - you have created a variable name using special characters from Unicodes Base Multilingual Plane. See here for a more detailed description Re: How can I use the newline equal sign just like...

 

But .... this method won't allow you to use these characters as a subscript as @ttokoro had done.
I guess @ttokoro  will be willing to explain his method in more detail if you ask.

 

Here is what you can get using the variable names which @ttokoro  had created in his Prime 11 sheet (which you presumably can't open in Prime 10)

Werner_E_0-1748094623657.png

I used the fat Boolean/comparison equal sign to avoid errors as of undefined variables. To duplicate the picture you provided as close as possible I also used implicit multiplications so no dot is shown. Implicit multiplications (PTC names it the "scaling operator") can be found in the operator menu or typed in via Ctrl+Alt+U.

 

As an alternative you may restrict yourself to (extended) ASCII characters which you simply could type in using the numeric keypad and having the ALT key pressed.

Werner_E_2-1748094873235.png

You could uncheck "italic" for "Variables" so the last example would look like this

Werner_E_3-1748095176046.png

But I would not recommend doing so as this would affect ALL names labelled as "Variable"

 

Prime 10 worksheet attached

 

 

 

@Werner_E , sorry for the late reply - I got so busy and hadn't been able to come back to this until today. That's very helpful. I was able to use your Mathcad 10 version of ttokoro's worksheet to copy and paste those variables with the symbolic subscripts into my worksheet. I had some additional variables that also could use these more streamlined symbolic subscripts, and I was able to copy these variables and then type an "S" or "V" as needed at the beginning and delete the "n" to now have all of my variables for these timber design calcs matching nicely. But I'm not able to replicate the symbolic subscripts that he used on my own. As you noted, one can work around the variable itself with the quotes, but not the subscript. 

@ttokoro, could you possibly explain how you did that? Is that only in Mathcad 11? Or, I know once upon a time, I could do a lot more stuff in the old Mathcad (like Mathcad 15) and then convert the file to Mathcad Prime and still have the items that I couldn't input in Prime. Did you do something like that? If so, this is really frustrating if one has to keep a much older version of a program to do fairly typical things that the newer version can't do. Also, what do you mean by "2byte codes"? Is that a different way of inputting the symbols? So far I'm not finding any explanation of your reference online.

Thank you much to both of you for the help!

Add some math regions in Werner's Mathcad Prime 10 sheet. See the attached sheet.

 

Hi @JM_9969096,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag

Announcements


Top Tags