Skip to content

Math preview: Add current tex dir to search path#1179

Closed
nanoant wants to merge 1 commit intoSublimeText:version4from
nanoant:patch/math-preview-add-tex-root-path
Closed

Math preview: Add current tex dir to search path#1179
nanoant wants to merge 1 commit intoSublimeText:version4from
nanoant:patch/math-preview-add-tex-root-path

Conversation

@nanoant
Copy link
Copy Markdown

@nanoant nanoant commented Jul 19, 2017

Adding current tex root dir to TEXINPUTS search path allows
"preview_math_template_preamble" to contain \input or \usepackage that pulls
files relatively to edited document, rather than temporary folder, e.g.

"preview_math_template_preamble": "\\input{symbols.tex}"

@nanoant nanoant force-pushed the patch/math-preview-add-tex-root-path branch from 7eec532 to ef31da3 Compare July 19, 2017 20:04
@r-stein
Copy link
Copy Markdown
Member

r-stein commented Jul 19, 2017

Sounds interesting. My main problem with this is, that using \input in that preamble is problematic* and should be avoided, so adding a feature to support it is in general not something I am looking forward to.

*Including other files is problematic, because the unique image identifier is build over the corresponding file content, so you will get a the same image for the same equation and already written equations are cached. If you use \input{otherfile} and change the content of the other file, the file's content will stay the same and hence you will have a wrong image and this will lead to problems.
However I will think about this (since it has been requested several times) and may come to a satisfying solution for it.

@nanoant
Copy link
Copy Markdown
Author

nanoant commented Jul 19, 2017

@r-stein Wow, thanks for instant reply. Indeed this may be not a perfect solution, but I needed it quickly. (La)TeX is pretty arcane and really terse in terms of available command line options and I had no better idea than using this TEXINPUTS variable.
But I guess you may have much better idea how to get this implemented well, so I look forward to it.
Cheers, Adam.

@r-stein
Copy link
Copy Markdown
Member

r-stein commented Jul 19, 2017

I like your solution =), but my problem is more on a meta level "How do I know that the included files have changed?", because we currently only use the file content to cache the document->image relationship here and this does not work with \input.

My ideas would be to search for \input{...} in the document and either

  • read the last change timestamp of the corresponding file and include it in the ID
  • just inline all included documents

@r-stein r-stein changed the base branch from master to version4 July 20, 2017 11:07
@nanoant nanoant force-pushed the patch/math-preview-add-tex-root-path branch from ef31da3 to ccaaf20 Compare July 20, 2017 14:03
@r-stein
Copy link
Copy Markdown
Member

r-stein commented Jul 20, 2017

Aside: You may state that you agree to an upcoming license #1175, thanks

@nanoant
Copy link
Copy Markdown
Author

nanoant commented Jul 20, 2017

@r-stein Oh yes, I hereby do agree to release my contribution to LaTeXTools under MIT license.

@evandrocoan evandrocoan mentioned this pull request Jul 23, 2017
59 tasks
@ig0774 ig0774 added this to the v4.0 milestone Mar 19, 2018
@bordaigorl
Copy link
Copy Markdown

I cannot believe I just created a PR that is identical to this one 😮 #1401

@nanoant
Copy link
Copy Markdown
Author

nanoant commented May 8, 2019

And here we go again 2 years later. Can we have this integrated? I know it is not perfect, but it better than nothing at all. And having predefined macros for symbols is really common case across many projects.

Adding current tex root dir to TEXINPUTS search path allows
"preview_math_template_preamble" to contain \input or \usepackage that pulls
files relatively to edited document, rather than temporary folder, e.g.

  "preview_math_template_preamble": "\\input{symbols.tex}"
@nanoant nanoant force-pushed the patch/math-preview-add-tex-root-path branch from ccaaf20 to 5775d6b Compare May 8, 2019 15:52
@r-stein
Copy link
Copy Markdown
Member

r-stein commented May 16, 2019

My comment still holds true. I understand the desire for this feature and also want to include it, but it is not easily possible with the current concept and may lead to performance issues if implemented in a different way.
I would be pleased if more/any development was done in LaTeXTools, because I think it's a nice package with a lot of potential for more features (especially with the new sublime text apis).

@bordaigorl
Copy link
Copy Markdown

@r-stein I really don't understand why you arw hesitating in merging this.
It seems that your foremost priority is that you can catch every change in the files so you know when to recompile. This is nice to have but definitely not essential:

  1. one simply needs to know that included/inputed files are not watched for changes and clear the cache when that happens
  2. the macro files are usually very stable while the formulas change a lot when you need the preview, so this is a perfectly ergonomic solution

On the other hand, not having this facility is a real pain, and the limitation in capabilities really does not justify the insistence on "watchability" of the changes.
Plus, this feature is completely optional and if one prefers to keep everything watchable, then one can simply not use inputs in the settings.

What is the problem???

@r-stein
Copy link
Copy Markdown
Member

r-stein commented May 17, 2019

I think it would be a compromise to merge it as opt-in with the remark that one needs to manually clear the cache in such cases?

@nanoant
Copy link
Copy Markdown
Author

nanoant commented May 18, 2019

@r-stein Just to be clear we are talking about manually running "LaTeXTools: Clear Cache" when the file.tex from \input{file.tex} changes? There is nothing else needed.

Shall I put the remark, or you can do it after merge?

@r-stein
Copy link
Copy Markdown
Member

r-stein commented May 20, 2019

Yes I mean the clear cache command. I will recheck this and create a setting for it

@ig0774 ig0774 deleted the branch SublimeText:version4 August 24, 2021 21:06
@ig0774 ig0774 closed this Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants