I want to switch over to KM for LaTeX text expansion. Currently I use Alfred Snippets. What it's lacking though is tabbing through cursor positions. I'm not sure, how I'd do that in KM, but maybe someone can explain it with an example:
I want to insert \frac{<First Cursor Position>}{<Second Cursor Position>}<Third Cursor Position>
So far it seems that I can specify the first cursor position via %I% which is fine. Now, it would be cool if I could trigger a hotkey that will jump to the next placeholder <CP>, and delete the placeholder. That way, it should be possible to realize nested placeholders.
\frac{%I%}{<CP>}<CP>
Or nested:
\frac{\frac{%I%}{<CP>}}{<CP>}<CP>
I don't really know however, how I would go about jumping to that placeholder and deleting it. What do the experts suggest?
I don’t using LaTeX but what I would do in this case is use “Prompt For User Input” and fill out the fields, and then have the end result be assembling that into the format that you want.
Thanks for the help. This works almost as wanted. One little problem is though, that I can't seem to call the prompt within a prompt. Any workaround for that?
Not that I know of. When the KM Prompt for User Input is displayed, that pauses the Macro, and you can't use another KM Macro to change anything in the displayed Prompt.
What you could to is use a text expansion tool like Typinator to insert data into the text blocks on the KM Prompt.
This is what I figured aswell. I can use my Alfred Snippets inside the prompts which is pretty good already. It bugs me a little bit, that I’ll have to split myself between two different programs, but I think I have what I need for now.
Another possibility:
I don't know if your LaTeX editor supports the usage of Apple's "Find Pasteboard". A lot of apps support the common keyboard shortcut cmd+g for "find next". KM gives you the "Set Find Pasteboard to Text" action making it possible tell the system what to use next.
So the steps:
Insert a fixed placeholter sequence into your text snippet, like
\frac{}{}
use the Set Find Pasteboard to text ""
Now you should be able to find-jump to the next occurance in a text
Sadly, that did not really work, and I'd also be not satisfied, if this was dependent on the editor.
I did however find a good workaround for now.
I've built an if condition that if the prompt input is xyz, another prompt will open to accept another input. I'm now looking how to encapsulate this process though somehow, because for the number of shortcuts I have, defining everything again all the time takes too long.