Suppressing quotes around strings in Input style.
- To: mathgroup at smc.vnet.net
- Subject: [mg122048] Suppressing quotes around strings in Input style.
- From: mmausr <opngid at gmail.com>
- Date: Mon, 10 Oct 2011 05:54:04 -0400 (EDT)
- Delivered-to: email@example.com
Mathematica suppresses the quotes surrounding a string by default in
the Output style. Quotes surrounding strings in the Input style can
be suppressed as well by setting the ShowStringCharacters option to
False in the notebook's style sheet for the Input style.
This approach is not entirely satisfactory, however, for the following
reasons. (i) Entering a double quote in an Input style cell after
setting the ShowStringCharacters flag to False will register an error
in the front end. (ii) It would be helpful to retain the color
change that is used for strings (gray by default) while the double
quotes are suppressed, but this does not appear to be possible with
the ShowStringCharacters flag set to False. In fact, manually
attempting to change the color of a string with the
ShowStringCharacters flag set to false will also register an error in
the front end. (iii) Inserting a file path does does not work
properly because of the explicit double quotes that surround the file
path string; this appears to be a special case of (i).
What would be useful is to have a special character that is invisible
that functionally acts like the double quote. Special characters
already exist as invisible equivalents for the @ symbol for function
application, the comma for argument separation, and the times operator
for multiplication. These invisible equivalents are respectively: \
[InvisibleApplication] \[InvisibleComma] \[InvisibleTimes].
It appears that the special character \:f3b5 somewhat plays the role
of a non-existent \[InvisibleDoubleQuote] character, but its precise
behavior depends on whether or not the ShowStringCharacters flag is
set. For example, if the flag is True, then a single \:f3b5 is
invisible, but entering a second (matching) \:f3b5 will make the pair
of double quotes visible.
Defining the following syntax transformation in
KeyEventTransformations.tr creates a pair of invisible double quotes:
Perhaps the color change could be defined in here, but I'm not sure
how. I'd also like to have the ability to insert double quotes for
certain situations into a notebook with the ShowStringCharacters flag
set to False, not just to insert file paths (that's easy to clean up
by just deleting the surrounding quotes and copying the result between
two \:f3b5 characters) but for strings that represent text messages.
My primary interest in being able to remove quotes around certain
strings is because I'd prefer to use strings as field names for
structs in an OO package that I'm developing instead of using
Protected symbols -- much for the same reason that many built-in
functions are using strings for option names instead of symbols in
later versions of Mathematica.
Prev by Date:
Re: Help in function defination
Next by Date:
Re: Wolfram LinkLibrary and additional dll on
Previous by thread:
Re: Rank of a matrix depending on a
Next by thread:
Re: Suppressing quotes around strings in Input style.