Facilitate completion

2013-02-22
2013-02-25
  • AlbrechtMehl
    AlbrechtMehl
    2013-02-22

    TXS comes pretty near to being perfect; but there is one feature missing. When editing a .tex file one likes to save time typing, especially when the typing is quite fast. So one starts typing a command and after two or three keys a menu pops up. This appears to be helpful, but isn't really. For an example consider \begin{verbatim}. TXS recognizes begin and shows a very long list of possible candidates. There verbatim is quite at the end of the list. So you have to put your hand to the mouse, to scroll to the bottom of the list, activate the specific item, and finally return your fingers to the keyboard. All this takes much time and is annoying.

    There should be within TXS something like the useful windows tool shortcut

    www.typer.de

    There you can create shortcuts either by entering them one after the other in a special input window or you can much more conveniently bind a txt file with your own shortcuts of the format

        shortcut=replacement
    

    I have a list of over 120 shortcuts, e.g.

    dc=\documentclass[]{}
    i=\item
    npb=\nopagebreak

    So I type

    dc<F7> F7 activates the replacement

    and get

     \documentclass[]{}  with the cursor between the []
    

    Shortcut has two shortcomings:

    • It is available for windows only. I regret this very
      much as my preferred OS is linux and TXS is available
      there, too.
    • It is a commercial program which has to be bought. The reasonable
      prize is ok in my opinion as the use of it is not restricted to
      a particular program: one can use it in any window, e.g. for
      one's address, for the name of a club etc.

    I suggest that the gurus of TXS have a closer look at the above cited homepage of shortcut and ponder then whether it would be worthwile developping something similar for TXS. Even when placing the cursor not at will, but always behind the last character of the replacement it would be nice to have such a tool within TXS.

    Being a simple user not familiar with the details of programs like TXS I have no idea how much work the addition of such a welcome feature would be. But in any case it would be good to discuss my the suggestion and let the user know what you think of it.

    A. Mehl

     
  • txs has already the possibility to work with shortcuts. You can assign shortcuts to any macro which you define, though every shortcut needs to start with backslash () and it is replaced after completing the shown command (marked as macro in the shown name)

    Apart from that, especially with environments it is more useful to use direct env completion by entering "verb" and pressing ctrl+alt+space.

     
    • AlbrechtMehl
      AlbrechtMehl
      2013-02-23

      I do know that txs has the possibility to work with shortcuts - that is nothing new to me. But ...

      Is there a possibility to write a .txt file using any editor
      and having there many lines relating shortcut and command as described
      in my first post?

      In case such a feature already exists I would be very grateful to get information on

      1. format of the line within the txt file,
        it is quite possible that the format should be different, e.g.
        not shortcut=replacement, but rather shortcut~replacement
        or whatsoever
      2. place where to put this file
      3. way of activating a particular shortcut within the txs editor

      A. Mehl

       
  • you can write a profile file yourself.
    That file need to be read-in via "options/load profile"

    the format needs to be like this:

    [texmaker]
    Macros\5=test2, ein kleiner Test2, \test2,

    "test2" is the macro name
    " ein kleiner Test2" is the text you want to set-in as replacement
    "\test2" is the abbreviation (mind the two backslashes in the file, they signify only one on read-in (special character handling)
    Don't forget the last comma.
    You can add as many macros as you like (in one file as well), though the numer after "Macros\" has to increase.