Closed lol768 closed 5 years ago
Good point, I don't see why not. Will add that. Though I do wonder whether it would be possible to allow users to assign shortcuts to whatever command they want. Will think about that if more requests like this keep coming in.
PS The shortcut would be Ctrl+Alt+Shift+E for consistency, I suppose. And because Ctrl+Shift+E seems to be assigned by default to a Recent Locations thing.
Hey @PHPirates
Good point, I don't see why not. Will add that
Great to hear, thanks!
Though I do wonder whether it would be possible to allow users to assign shortcuts to whatever command they want. Will think about that if more requests like this keep coming in.
I'd be in favour of this. I've experimented with IDEA's built-in macro system but there's a lot to be desired there. In an ideal world, the sort of things I'd want are:
description
environment, texstudio inserts this for me and puts the cursor on the key
:\begin{description}
\item[key] value
\end{description}
itemize
, similar concept to aboveenumerate
, as abovePS The shortcut would be Ctrl+Alt+Shift+E for consistency, I suppose. And because Ctrl+Shift+E seems to be assigned by default to a Recent Locations thing.
Yeah, I think that sounds reasonable - if I hadn't migrated across from texstudio I'd have stuck with the default keybindings. If it's like the other keyboard shortcuts that the plugin supports, it'll be possible to override in the settings, right?
Good idea, about the macro system. I just recorded a macro for the itemize environment insertion you mentioned using Main Menu | Edit | Macros | Start macro recording, and then I assigned a shortcut to it. Can you try if that works for you?
it'll be possible to override in the settings, right?
Yes of course.
Btw, to backup the macros, mine were in ~/.IntelliJIdea2019.1/config/options/macros.xml
.
If it works for you, I will add it to the readme.
Good idea, about the macro system. I just recorded a macro for the itemize environment insertion you mentioned using Main Menu | Edit | Macros | Start macro recording, and then I assigned a shortcut to it. Can you try if that works for you?
The macro approach does work... and I've being very nitpicky here - but it's just a bit slower and jankier than texstudio which inserts the environment straight away:
If we look at the shortcuts with TeXiFy-IDEA natively supports, they don't have this problem:
That's certainly true. In the meantime I also found that my macro fails to indent correctly. And of course you can't double-click on a word and hit the emphasis shortcut to add an emph when you use macros.
I'll think about any other way for users to specify things themselves, and if I can't find anything I will just add these to the plugin. To give me an idea, do you have any more shortcuts you want but haven't mentioned?
I just remembered we do have a live template for frac
already, try typing frac
. maybe live templates could be used?
When I create a live template for your environment insertion, then create a macro which types the key of that live template, then assign a shortcut to that macro, then when I hit the shortcut+enter the whole thing inserts really fast, and with correct indentation. Does this work for you?
I will add it to the readme anyway, because it seems to work for me at least. But first I'm going to sleep a night about that :smile:
Live template:
\begin{itemize}
\item $PARM1$
\end{itemize}
For the emph you can just create a macro, because it inserts just as fast as the predefined ones to my untrained eye.
It took me a little bit to figure out how this works, I was trying $<cursor here>\frac
but I noticed in the issue it was known not to work directly next to a dollar.
It works fine with $2 = <cursor here>\frac$
and you can expand it into $2 = \frac{4}{2}$
or whatever.
I think this works well, texstudio does something similar, you can type \frac
and it'll auto-complete and then let you jump back and forth between the parameters like we can with TeXiFy:
This similarly works with the description environment, and you can invoke from a key binding:
In this vein, I only wish https://youtrack.jetbrains.com/issue/IDEA-67811 hadn't been closed as won'tfix. It would've given us exactly what we want just by using live templates.
I did wonder if it's possible to record a "Surround with live template" invocation inside a macro and then somehow bind that to a keyboard shortcut, but didn't get very far.
To give me an idea, do you have any more shortcuts you want but haven't mentioned?
Now that you've brought up fractions, I remembered that I have Ctrl+/ bound to \frac
in texstudio. The only other things I could think of are citations (I'm a \citep
person) and \label
/\ref
but I guess this is all pretty subjective.
When I create a live template for your environment insertion, then create a macro which types the key of that live template, then assign a shortcut to that macro, then when I hit the shortcut+enter the whole thing inserts really fast, and with correct indentation. Does this work for you?
Let me try! I didn't think to try typing its name
In this vein, I only wish https://youtrack.jetbrains.com/issue/IDEA-67811 hadn't been closed as won'tfix. > It would've given us exactly what we want just by using live templates.
I found the same one, can only agree about that.
... yeah as I posted you almost can, if you bind the typing of the live template key to the macro. You need to hit an extra enter though, but I don't think that's a big problem.
I think plain commands you can just do with a macro, just as with emph. So then I think we should be good.
When I create a live template for your environment insertion, then create a macro which types the key of that live template, then assign a shortcut to that macro, then when I hit the shortcut+enter the whole thing inserts really fast, and with correct indentation. Does this work for you?
This does do the trick. I tried recording the EditorChooseLookupItem too to try and get it to match exactly what texstudio does (i.e. remove the need for the extra Enter):
This doesn't work though (and I guess you had the same experience), which I think might be an IntelliJ bug. Either way, it's pretty damn close and fixes the lag issue I complained about earlier, so thanks for that!
I think plain commands you can just do with a macro, just as with emph. So then I think we should be good.
Agreed, and I think description
will work in the same way with "PARM1" and "PARM2" for key and value
Yeah I found the same problem. May be a bug, will fiddle a bit with that tomorrow, and add the whole procedure to the readme (or you could do that of course, if you want). That's good to hear, thanks for helping out!
By the way, what do you think are the main missing features in general of TeXiFy compared to texstudio? I am curious how people experience the change from other editors :)
Yeah I found the same problem. May be a bug, will fiddle a bit with that tomorrow, and add the procedure to the readme.
Reported as https://youtrack.jetbrains.com/issue/IDEA-210590 for now, LMK if you find a workaround
By the way, what do you think are the main missing features in general of TeXiFy compared to texstudio? I am curious how people experience the change from other editors :)
I've been using properly for a day (to work on my dissertation) so far. I got fed up with texstudio being unstable, and had seen TeXiFy-IDEA a while back (tried it out a while back but it still wasn't quite as mature and I went back to texstudio, but kept an eye on it). It's at a stage now where it's good. I'm happy using it consistently, I have all the features of the IDEA platform.
Some things I miss:
pdf2svg
and inkscape
installed. It doesn't appear to do anything when I select an equation and choose the option. Same for the tikz preview.\citep
s. Could be an issue with my document.Things I like:
minted
so much nicer.\include
'd in the main document)\def
, \makeatother
)Minor gripes:
Code:
% Set up example boxes
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Example]{exampleflt}
\captionsetup[exampleflt]{labelfont=bf}
\newenvironment{example}[1]
{\begin{exampleflt}[tb]
\begin{mdframed} \setlength{\parskip}{1em}
\captionsetup{name=\faPuzzlePiece{} Example, singlelinecheck=false,font={color=id7-aubergine,sf},position=top}
\vspace{0.5em}
\caption{#1}\hfill
\vspace{-1.8em}
\rmfamily
\captionsetup{style=default}
}
{\end{mdframed}\end{exampleflt}
}
\begin{keywords}
Type Systems, Refinement Types, Application Security, User Input, Satisfiability Modulo Theories,
Programming Languages, Static Analysis
\end{keywords}
Gets auto-indented as:
\begin{keywords}
Type Systems, Refinement Types, Application Security, User Input, Satisfiability Modulo Theories,
Programming Languages, Static Analysis
\end{keywords}
Maybe I'm alone in indenting stuff I put in environments? I dunno :stuck_out_tongue:
Thanks for reporting that issue to Jetbrains, that should at least give some information I hope.
Thanks a lot for the review! I am going to reprioritize the list based on that - sometimes I have the feeling that I'm fixing all these minor issues nobody cares about instead of doing the important things. (I'm using ZenHub for that, not the GitHub board, so if you don't have that extension you won't see it but it's there)
For reference:
The embedded PDF viewer in texstudio was nice, I have to admit. No idea how feasible this is.
We tried finding PDF viewer libraries for java, but they are either not suited for our purpose, or they are commercial. Licensing is a big issue here. Also plugins like PDFViewer have not been updated in ages. We tried looking into PDF to image converters, but they have roughly the same kind of problems. If you happen to find useful libraries, please let us know! We are definitely not going to write a fully fledged PDF viewer :P
Personally, I'm not really bothered by having a pdf viewer like sumatra open. Works well enough.
About the shortcuts: I like that you found a solution using default IntelliJ functionality. Things like shortcuts for live templates is something that should be outside the scope of this plugin as it is not directly related to LaTeX.
However, we could think about adding several frequently used commands to the context menu like we did with sectioning and font style. When you make a menu item, you can bind them shortcuts. Leaving out a default shortcut makes it an optional feature.
@RubenSchellekens Yeah I was on the point of doing so, but I wasn't sure about how far we should go in incorporating desired shortcuts, so as long as there are no two requests for the same command I preferred to use the live template solution. But I think you would need to design some icons if you want to include the mentioned shortcuts? :)
No icons needed really. See TeXstudio. The icons for font style are more because you're used to seeing these icons in virtually every text editor. And because I had fun making them ;)
but I wasn't sure about how far we should go in incorporating desired shortcuts
You just leave out a default shortcut. People can add them themselves in Settings
> Keymap
if they feel the need to. Menu items are never really a problem. New LaTeX users might even find it useful to browse through the commands.
Menu items are never really a problem.
Alright agree, good point about leaving out the default shortcut. @lol768 you are free to add the insertion actions for emph, description, itemize, enumerate, frac, cite, label ref etc. if you want :) otherwise I can do them later on.
We tried finding PDF viewer libraries for java, but they are either not suited for our purpose, or they are commercial. Licensing is a big issue here. Also plugins like PDFViewer have not been updated in ages. We tried looking into PDF to image converters, but they have roughly the same kind of problems.
Yeah, this is a hard problem. The only (pretty ugly) suggestion I have here is combining Mozilla's pdf.js and something like JavaFX's WebView.. I think for anything better than that, you'd need to do JNI and talk to something like Poppler - and even then you'd need to write your own rendering backend for it because it only supports Cairo. Making this reliably work cross-platform is more of a headache, I'm sure.
If you happen to find useful libraries, please let us know! We are definitely not going to write a fully fledged PDF viewer :P
And I don't blame you! :laughing:
Personally, I'm not really bothered by having a pdf viewer like sumatra open. Works well enough.
I'll get used to having evince open, I'm sure. I already use a tiling wm so it's not a big issue.
Thanks a lot for the review! I am going to reprioritize the list based on that - sometimes I have the feeling that I'm fixing all these minor issues nobody cares about instead of doing the important things. (I'm using ZenHub for that, not the GitHub board, so if you don't have that extension you won't see it but it's there)
The minor things keep it polished, but yeah, I've found user feedback really helps with deciding priorities.
unstable equation preview: No current bug reports open (and works for me on Linux). Please raise a separate issue when you want to debug this. But yeah it heavily depends on external tools so this is not unexpected.
Happy to help debug this, I'll raise a separate issue.
Go to declaration for refs, labels: Hm, also works for me. I can control click on a reference. Please raise a separate issue when you want to debug this. Seems like yours is a good test system
Either that or my document is too complex! I did wonder if this was related to the parse issue (maybe it is unable to properly parse the rest of the document once it sees the broken environment) since it works in a fresh document. Will raise a separate issue.
Package documentation: #2 Newenvironment definition parse error: #825 Formatter: #567 (Agree on importance, but after #24 I need some extra courage to start on this...)
Thanks for raising/linking these! I'll check them out and keep an eye on them.
Fixed in #856
I know we have the ability to set up a shortcut for e.g.
\texttt
and\textit
, but I miss being able to do Ctrl+Shift+e as in TeXStudio to get an\emph{..}