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

Allow Latex expressions in single-line titles and Cartesian axes labels #4566

Merged
merged 57 commits into from
Dec 24, 2020

Conversation

PaulWessel
Copy link
Member

@PaulWessel PaulWessel commented Dec 13, 2020

Description of proposed changes

See #4563 for background. This PR implements the ability to place Latex expressions in titles and labels. Users who wish to use this feature must have a working installation of latex and dvips as well as recommended fonts. Because a title may contain a mix of text and equation, I change the default Latex font to match the corresponding title or label font chosen in GMT. The correspondence should work for all of our standard fonts, e.g., Helvetica, Times-Roman, Courier, Bookman, Palatino, etc.

Some limitations that may be relaxed later:

  1. Only single-line titles can have Latex expressions in them.
  2. The subplot -Theading has not been updated for latex (nor multi-line headings) yet.
  3. colorbar may also need some more work.

I have updated the documentation and added two test scripts (latextitle.sh and latexlabel.sh). The output of the latter looks like this:

latexlabel

Feel free to test-drive this PR to possibly expose any issues. Once acceptable we also need to update the run-time dependency entries on the wiki and Building.

@PaulWessel PaulWessel added the new feature PR that implements a new feature or capability in GMT label Dec 13, 2020
@PaulWessel PaulWessel self-assigned this Dec 13, 2020
@PaulWessel PaulWessel changed the title WIP Allow Latex expressions in single-line titles and Cartesian axes labels Allow Latex expressions in single-line titles and Cartesian axes labels Dec 13, 2020
@PaulWessel
Copy link
Member Author

I believe I have completed this pull request by also allowing Latex-expressions in pstext (except for paragraph mode -M). I have added a new test latext.sh to demonstrate this latest feature:

latext

Please give this PR a review now, @joa-quim, @seisman and @meghanrjones.

doc/rst/source/cookbook/options.rst Outdated Show resolved Hide resolved
doc/rst/source/cookbook/options.rst Outdated Show resolved Hide resolved
doc/rst/source/cookbook/options.rst Outdated Show resolved Hide resolved
doc/rst/source/explain_-B_full.rst_ Outdated Show resolved Hide resolved
doc/rst/source/explain_-B_full.rst_ Show resolved Hide resolved
doc/rst/source/explain_-B_full.rst_ Outdated Show resolved Hide resolved
doc/rst/source/pstext.rst Outdated Show resolved Hide resolved
doc/rst/source/cookbook/options.rst Outdated Show resolved Hide resolved
doc/rst/source/cookbook/options.rst Outdated Show resolved Hide resolved
doc/rst/source/cookbook/options.rst Show resolved Hide resolved
doc/rst/source/explain_-B_full.rst_ Outdated Show resolved Hide resolved
doc/rst/source/cookbook/gmt-latex.rst Outdated Show resolved Hide resolved
@PaulWessel
Copy link
Member Author

Also fixed that remaining #break; to <break>

@seisman
Copy link
Member

seisman commented Dec 23, 2020

@PaulWessel Do you mind moving the 4 latex tests into a separate directory, e.g, latex? It would be easier to exclude them from the tests if latex or dvips are not found.

@PaulWessel
Copy link
Member Author

@PaulWessel Do you mind moving the 4 latex tests into a separate directory, e.g, latex? It would be easier to exclude them from the tests if latex or dvips are not found.

Good idea, will do soon but in the middle of Xcode debug on another branch... Or you can do it, create a latex test folder and move the ones from psbasemap and pstext I think. Not sure about doc/scripts/GMT_latex.sh though as not a test.

Changes in this PR:

1. Move the 4 latex tests to the directory `latex`
2. Exclude LaTeX tests if latex or dvips are not found
@seisman
Copy link
Member

seisman commented Dec 24, 2020

After installing the full mactex via homebrew brew install --cask mactex-no-gui, the LaTeX feature now works well for me.

There are still a few comments to address:

We may also need to add instructions to install LaTeX in the wiki.

@PaulWessel
Copy link
Member Author

I recommend fixing the warning that
gmt/dbuild/doc/rst/source/cookbook/gmt-latex.rst: WARNING: document isn't included in any toctree
by adding cookbook/gmt-latex to the toctree in doc/rst/source/cookbook.rst (the toctree starts at Line 35, gmt-latex could go right below postscript-fonts at L50) before merging. GitHub only allows suggesting line changes to files that have been edited, which is why I cannot suggest this change directly through a PR review.

Thanks, now committed

@PaulWessel
Copy link
Member Author

After installing the full mactex via homebrew brew install --cask mactex-no-gui, the LaTeX feature now works well for me.

There are still a few comments to address:

We may also need to add instructions to install LaTeX in the wiki.

Warnings fixed. instructions for wiki next but not in this repo.

@PaulWessel
Copy link
Member Author

Yippie!

@PaulWessel PaulWessel merged commit 6d8d2f0 into master Dec 24, 2020
@PaulWessel PaulWessel deleted the gmt-latex branch December 24, 2020 22:00
@seisman
Copy link
Member

seisman commented Dec 25, 2020

FYI, I created a wiki page for "how to install LaTeX" at https://github.com/GenericMappingTools/gmt/wiki/Install-LaTeX-for-GMT-LaTeX-Integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature PR that implements a new feature or capability in GMT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants