-
Notifications
You must be signed in to change notification settings - Fork 340
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
Reference using LaTeX style \ref for titles/text #6567
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute! Please make sure you read our Contributing Guide and abide by our Code of Conduct. |
I understand your request and why this would be especially helpful for a thesis or book with lots of figures where manually handling such changes could be a headache. I dislike manual intervention as well. However,... When we handle the equation we simply create a tiny latex file with that math and render it to an EPS file. This EPS snippet is then placed as any other image or EPS in GMT. This works pretty well and was not too taxing on old brains to figure out and implement. Working on a paper in Latex myself, I know that when I run my pdflatex commands it builds the *.aux file and it is full of these types of commands:
So I know that my figure WKWS22_Fig_flux is figure 7 and will appear on page 9. In general, I can see us taking the ref argument and finding and returning the item number and the page number. But I dont know how we would make any use of the page number. We dont even know from this whether the ref is a figure or equation, for instance, but that is OK since you have to know that anyway as you type Fig.~\ref{myfig} in the text. I dont know how one would set something that would be formatted as "As we saw in Fig. 43 on page 144". For GMT to learn this we would have to assume you already have run latex so the aux file is up to date. Then, we would need to know the prefix of you Latex file so we can look for prefix.aux. We must also find any \ref{} statements in the latex text given to GMT so it can look up that reference and replace it. Since building the paper files may involve a Makefile and special commands we have to assume the *.aux is up to date. How should you pass the Latex name? Some options:
Since there is no specific option that deals with Latex issues I think those are the two possibilities. Of these, 99% of GMT users cannot spell Latex so that makes the less intrusive environmental setting more appealing to me. The reference thing is totally different than the equation since GMT is not running latex at all - just fishing out some info from a file and replacing any \ref{} we find in text. So it should be very simple to implement compared to equations. We would do it first before any Latex checking happens since you may have a figure title like Happy to see what others in the @GenericMappingTools/gmt-team thinks of this request and my sketched-out solution. I am not particularly convinced that referencing figure numbers from a figure itself is widely used but perhaps it is because it is a pain in the ankle... |
To run latex and generate the aux files, users need to have their GMT images ready. So it means that users have to:
It looks really complicated to me. Once GMT supports |
Fair enough. It is also likely that there can't be that many figures even in a thesis that want to cite figures. So, how much work is it to deal with one or two figures manually versus robbing the GMT team a perfectly good weekend to implement something like this? |
The way I would have done it is by calling GMT script from LaTeX ( PSEUDO-CODE
Maybe you can work something from this ? |
These are pretty valid points and I think for a REALLY robust solution it would need to be done like this, however for me at least I think @PaulWessel's solution would work. This would leave the onus of making sure the Latex file is up to date and that the figure order is correct (and will remain correct after updating the figures) on the user. I think this would be OK, especially if documented properly. It would basically make the proposed feature a "Latex .aux file parser" |
Description of the desired feature
![image](https://user-images.githubusercontent.com/15933842/163694462-16d243a3-62fe-4c8d-a95e-7a6a4cca3fc6.png)
I am writing my thesis using LaTeX and want to make a map which shows the location of data that I am showing in other figures. Ideally the figure numbers could be automatically generated, to make a map looking something like this:
As figure numbers can change when more figures are added automatic generation would save lots of time and ensure consistency and correctness too.
It is already possible to include LaTeX equations, but from what I can see this doesn't extend to other LaTeX macros.
Does anyone know what would be involved in implementing this feature?
Are you willing to help implement and maintain this feature? Not for a few months...
Looking forward to some discussion on this, I'm very impressed with GMT overall and the community seems really great.
Cheers
The text was updated successfully, but these errors were encountered: