Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to be more consistent with minus and hyphens #391

Closed
wants to merge 1 commit into from

Conversation

PaulWessel
Copy link
Member

Because the different character sets have different octal codes for minus and hyphen we may sometimes have to replace the typed hyphen character with a minus and vice versa. Now only adding in a minus if what follows is a number and it is the only number. Partly addresses #388.

Because the different character sets have different octal codes for minus and hyphen we may sometimes have to replace the typed hyphen character with a minus and vice versa.  Now only adding in a minus if what follows is a number and it is the only number.  Partly addresses #388.
@PaulWessel
Copy link
Member Author

I wonder what the best solution should be. The current one is not perfect for sure. If the string is
-A -B -C -123
then the -123 will not be typeset with a minus sign. Perhaps the input string should be scanned for individual words and then the rule applied (minus used if what follows is a valid number). Comments?

@seisman
Copy link
Member

seisman commented Feb 1, 2019

I don't think we can find a perfect solution. For example, if someone want to write Y = aX - b in a plot. It's impossible to know that we should replace - with minus symbol in this case.

IMO, we only need to do the hyphen-minus replacements for annotations, since it's out of control by users. For labels, titles and other texts, users have full control, they can determine what they want to use.

@PaulWessel
Copy link
Member Author

OK, then I think we are OK. The fix I added caught the leading -A and no longer replaces that with a minus symbol. I think that is the correct guess and if the user means "minus variable A" then they can use octal codes as needed.

@seisman
Copy link
Member

seisman commented Feb 1, 2019

Can we just ignore all hyphens except that in annotations?

See code:

echo 0 2 '-123 -456' | gmt text -Jx1c -R-5/5/0/3 -Baf -B+t'-123 -456' -pdf hyphens

image

@PaulWessel
Copy link
Member Author

Yes, that is possible but requires a few changes since I implemented the current scheme inside postscript light so it does not know what it is being passed. Doing it at a higher level (in gmt_plot.c) will be required.

@seisman
Copy link
Member

seisman commented Feb 1, 2019

IMO, postscript library shouldn't make the changes.

@PaulWessel
Copy link
Member Author

OK, we will keep this open and await my return to Hawaii early next week. We will move the hyphen/minus code portion into the annotation machinery then.

@PaulWessel
Copy link
Member Author

Before doing that, how about applying the definition of what a hyphen is:

a short line (-) used to connect the parts of a compound word or the parts of a word divided for any purpose

That means things like -123 -AB15 cannot use hyphens (so set as minus) whereas -123 ta-da -B16 have a hyphen in ta-da. Constructs like -BBB cannot use a hyphen so it must use a minus. This is more consistent since the example above will have two minus symbols.

PaulWessel added a commit that referenced this pull request Feb 6, 2019
By using the definition for what a hyphen is (shhort line between two words) we can typset hyphens when that situation occurs and use minus for numbers and single items.  See issue #391 for context.
@PaulWessel PaulWessel closed this Feb 6, 2019
joa-quim pushed a commit that referenced this pull request Feb 6, 2019
By using the definition for what a hyphen is (shhort line between two words) we can typset hyphens when that situation occurs and use minus for numbers and single items.  See issue #391 for context.
@remkos remkos deleted the hyphenfix branch February 8, 2019 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants