Open JackGin opened 8 years ago
Btw, is there a chance for LatexTools to be ported to the Kate text editor, maybe like a plugin? https://kate-editor.org/ It seems that Kile, a Kate Latex frontend, is dead, but Kate, as an editor, is so cool and promising, definitely as cool as Sublime.
I doubt, that there will be support for more editors.
For the feature request: I also think it would be a nice feature, but it requires the data about the commands. Taking this from somewhere else might result in license issues as for the cwl completion https://github.com/msiniscalchi/atom-latextools/pull/53#issuecomment-228611775. However I think it would be useful to add in the future in Atom and also in Sublime Text 3.
Concerning the data about the commands. This is a simple correspondence between mathematical symbols and latex commands, which is present in every latex textbook. The image of the symbols is just the latex output. I do not see how it can break any license or something. I can easily arrange a table like this myself, as soon as the file format needed for Atom/Sublime becomes clear.
The information itself does not break any license. However we would need it in a json compatible format, e.g.
[
{
"category_name": "arrows",
"symbol": "⇔",
"entries": [
{
"command": "\\leftarrow",
"symbol": "←",
"package": null
},
{
"command": "\\rightarrow",
"symbol": "→",
"package": "latexsym"
},
// ...
]
}
]
This would just contain the structure and the shown information. The symbols should be uft8/unicode symbols, althrough displaying png images should also be possible. With that it would be quite easy to build an insertion popup in Sublime Text and I assume it cannot be that hard for Atom either (I mainly focus on the ST version of LaTeXTools and I am not so experienced with the Atom API).
This is easily doable in Atom, assuming such a document can be created and I can find some time to setup the GUI. Actually, the ability to create essentially arbitrary UI elements is the one thing where Atom is miles ahead of ST (in my opinion anyways).
It's probably best to use PNGs or some other image format to display the images. If we stick to utf-8 / Unicode, we're dependent on the display font. I don't know of any OS that ships with a UTF-8 font with the full range of math symbols and TeX system don't by default install such a font into the system fonts, which means we can't rely on an appropriate font being on the users' system. (Incidentally, looking at TeXStudio's Mecurial repository, they appear to have use PNGs before switching to SVGs).
Yes, I agree that it will look way better in Atom. Since ST is very limited and does not support tables. Anyway it is super easy to create a popup in ST:
view.show_popup(" ".join('<a href="{0}">{0}'.format(i) for i in range(10)), on_navigate=lambda href: view.run_command("insert", {"characters": href}))
For unicode vs images (at least ST does not support svg): If we use unicode it requires the font to support it, which is a huge disadvantage. However with images we may need to adapt the size and also tint it to fit the colorscheme (if we don't just want to have a white popup).
Imho, it is better to choose images over fonts to avoid problems with missing fonts. I could make the document that sets the correspondence between latex commands and images. But I need the example of code that shows how to insert images. Also, we have to choose the most appropriate graphic format (png -- with transparent background? -- svg, or maybe pdf), size, dpi and colour.
I think it would be the best to just insert the image names into the json and put all images into a folder. The images itself should be png with transparent background and black foreground. The DPI/size is a little bit problematic, because people use different displays and at least sublime does a bad job at downscaling such images (it removes thin lines).
I think it would be the best to just insert the image names into the json
I would be so grateful if you could show me a line of code that does the trick. Never wrote any json files in my life.
The DPI is a little bit problematic
I hope, 90 dpi is ok for most purposes?
Yes, I think it woud be the best to use the size in which it should be shown with a good dpi.
The json would look like this (you can also omit the package):
[
{
"category_name": "arrows",
"symbol_image": "double_arrows.png",
"entries": [
{
"command": "\\leftarrow",
"symbol_image": "left_arrow.png"
},
{
"command": "\\rightarrow",
"symbol_image": "right_arrow.png"
"package": "latexsym"
},
// ...
]
},
{
"category_name": "relations",
"symbol_image": "relation.png",
"entries": [
{
"command": "\\leq",
"symbol_image": "leq.png"
},
{
"command": "\\geq",
"symbol_image": "leq.png"
},
// ...
]
},
// ...
]
Beside package we could add additional meta data if you have an idea for that.
Perfect. Thank you, dear Richard! I will prepare such files and upload them in several days.
Ok nice. I will add it to Sublime Text and will also try to do it for Atom, maybe together with @ig0774 .
Hi,
is it possible to add a quick access to different math symbols, like in Kile and TeXstudio? Here is a descriptive picture: http://www.texstudio.org/images/symbols.png Maybe, one could use some shortcut to trigger a pop-up menu with math symbols. Thank you!