Latex-workshop: Preview the table, picture and math in the editor

Created on 6 May 2018  路  9Comments  路  Source: James-Yu/LaTeX-Workshop

I hope that we can preview the table, picture and math in the editor, it will be easier and more useful for us. XD.

enhancement

Most helpful comment

https://github.com/siegebell/vsc-prettify-symbols-mode has support for real time math prettify in LaTeX.
does not support table and image (I doubt previewing image is possible in vscode version 1.23).

However, this feature does not cover all the math symbol, and it is not in the latest release (v0.4.0) of the plugin. You have to install it yourself.

All 9 comments

Can you please give a small example? A conceptualized figure is preferred.

When the mouse hovers over the figure name:Fig_Q0.png, a preview will show. (This function allows me to check whether the file name is written correctly )
screen shot 2018-05-06 at 12 54 47

XD

The function in my capture is realized in sublime text by package 'LatexTool'

Unfortunately this seems not possible with the current vscode api. I'll leave this issue open as a feature request.

To at least solve the "check if written correctly" part of this, I think some 'insert relative path' functionality would also be enough.
Similar to this plugin: https://github.com/jakob101/RelativePath

What should be supported I think:

  • A command to insert the relative path to some file in the workspace.
  • Maybe some filtered subcommands that are triggered in certain scenarios (similar to \cite and \ref) e.g.:

    • Image types in \includegraphics

    • .tex and similar files in \input or \include

  • Document root path should be considered e.g. the current tex file is in a subfolder and the images are in another subfolder (i.e. %!tex root = ../Main.tex). Then the correct relative path is ./img/Cat.jpg and not ../img/Cat.jpg.
  • Not necessary but I think all paths should start with at least one dot

I thought about adding something along these lines back when I added the tex root creation command, as I think these functionalities are related.

What is already here:
In the TexMagician class somwhere is a function that calculates the relative paths of two file paths provided. So the path would be calculated by:

  • Check if tex root is set

    • If no: relativePath(currentFile, selectedFile)

    • If yes: relativePath(texRoot, selectedFile)

Problems: I don't know if and how people use tex root. Is it for example common, to include some tex file in two different main documents which are in seperate folders? Is it possible to nest tex-root commands?

This one is unlikely, since you never know how many directories are there in a project's root, or how deep they are. Suppose some random guy somehow has his node_modules in the same folder. That is a performance hit.

https://github.com/siegebell/vsc-prettify-symbols-mode has support for real time math prettify in LaTeX.
does not support table and image (I doubt previewing image is possible in vscode version 1.23).

However, this feature does not cover all the math symbol, and it is not in the latest release (v0.4.0) of the plugin. You have to install it yourself.

On this idea, I thought it would be worth linking to an extension that implemented something that seems similar - gutter preview.

Demo Image

@tamuratak do you think you can add support for hovering over images? that would close this issue

I suggest to open a new issue for image preview if there is any interest in this feature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dslemusp picture dslemusp  路  4Comments

s-ilic picture s-ilic  路  3Comments

jabooth picture jabooth  路  3Comments

BjoernDaase picture BjoernDaase  路  3Comments

mdrozdo picture mdrozdo  路  4Comments