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

Tikzpicture preview #1450

Closed
9 tasks done
tecosaur opened this issue Jun 18, 2019 · 12 comments · Fixed by #1500
Closed
9 tasks done

Tikzpicture preview #1450

tecosaur opened this issue Jun 18, 2019 · 12 comments · Fixed by #1500
Assignees
Labels
latex utilities issue Related to LaTeX Utilities

Comments

@tecosaur
Copy link
Contributor

tecosaur commented Jun 18, 2019

Hi All,

I had an idea earlier for previewing tikzpicturs — #1427 (comment) and I'm pleased to say I've actually made some progress towards it — tecosaur/LaTeX-Workshop/tikzpicture-codelense.

image

I'm not actually too far off, this is the current state of affairs

  • Locate tikzpictures
  • Create codelense
  • create standalone file
  • compile
  • preview
  • identify important tikz lines in file and include
  • keep track of same tikzpicture and same standalone file
  • recompile after typing in tikzpicture
  • precompile preamble for faster compilation

Looking for general feedback / ideas on this.

@jlelong jlelong added the enhancement Issue suggests an enhancement label Jun 20, 2019
@tecosaur
Copy link
Contributor Author

tecosaur commented Jul 9, 2019

Update: No change yet, will do a bit more work on this soon. I've had some ideas about how to keep track of the same tikzpicture environment.

@tecosaur
Copy link
Contributor Author

Currently looking for tikz 'bits' that should be pulled out of the main document for generating the preview. Stuff like tikzset. Any suggestions very welcome.

@tecosaur
Copy link
Contributor Author

tecosaur commented Jul 11, 2019

Update: Progress is being made! More details to come later. Shouldn't be too long before I start a PR.

@david-waterworth
Copy link

david-waterworth commented Jul 14, 2019

Nice work, it would be awesome if this worked for standalone tikz files referenced via \input , perhaps with a magic to point to a template file similar to how ktikz works (i.e. ktikz_template.pgs sets up the preamble/preview environment for a standalone tikz file).

I normally put my tikz files in a comon figures folder and input them into the document - the tikz files themselves aren't standalone since the document preamble sets up colours etc).

@david-waterworth
Copy link

david-waterworth commented Jul 14, 2019

Currently looking for tikz 'bits' that should be pulled out of the main document for generating the preview. Stuff like tikzset. Any suggestions very welcome.

I have the following preamble required to support tikz. Not sure how you'd detect the colour references though? As I mentioned above, as an option perhaps a magic to a template could be used with a default?

\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\definecolor{blue}{HTML}{0081FF}
\definecolor{grey}{HTML}{B0B0B0}

\usepackage{pgfplots}
\pgfplotsset{compat=1.12} 
\usepgfplotslibrary{fillbetween}

@tecosaur
Copy link
Contributor Author

Thanks for the example preamble. I can try expanding the regex to get all those important bits. Here's a demo
image
https://regex101.com/r/QcMKoe/1

If you have any other samples, I'd appriciate them 😃

Re: \includes — that sounds like a good idea, but I think we'd need some way of identifying that they are just tikzpictures, and not something else.

@david-waterworth
Copy link

I'm only just starting to use tikz, as I come across other stuff I'll upload.

Although it'll be quite difficult to get everything from the preamble that might be used in a fragment since you can put equations for example which might depend on a define from the preamble.

You may need to take the entire preamble?

@tecosaur
Copy link
Contributor Author

That's why my implementation has the setting latex-workshop.tikzpreview.preambleContents which is a path to a file, the contents of which are inserted into the preamble used.

@david-waterworth
Copy link

Excellent, so it should work the same as gtikz / ktitz whihc is nice!

@tecosaur
Copy link
Contributor Author

ktikz looks like a decent comparison to what I want this to end up being as capable as. In my opinion the "tikz commands" part of my Snippets Pannel PR should also help make creating tikz figures easier.

@tamuratak tamuratak added latex utilities issue Related to LaTeX Utilities and removed enhancement Issue suggests an enhancement labels Aug 4, 2019
@FMuro
Copy link
Contributor

FMuro commented Jul 26, 2020

Now that LaTeX Utilities is unmaintained, would it be possible to recover TiZK previews in LaTeX Workshop? I think that this particular functionality should have never left, since TiKZ is more popular everyday.

@tamuratak
Copy link
Contributor

No.

Repository owner locked as resolved and limited conversation to collaborators Jul 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
latex utilities issue Related to LaTeX Utilities
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants