Menu

Space before "percent" sign ...

TXS - Help
Meho R.
2010-07-26
2024-06-17
  • Meho R.

    Meho R. - 2010-07-26

    Hi,

    Why is there an automatically inserted space before percent sign (%) when it's
    used for commenting? This can be really problematic (e.g. when commenting out
    the end of a line just to put a footnote in the next) and very annoying. Is
    there a way to disable/prevent this behaviour except deleting the space every
    time?

     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2010-07-26

    there is no space in front of the percent charatcer here ...
    so, what tmx version, what os ?
    And what key replacements are definde on your system (Options/Shortcuts
    Editor/key replacements (in the table))

     
  • Benito van der Zander

    In the default configuration "%" is replaced by " %" after a word, but you can
    disable this replacement in the key replacement options.

    However, I think it is annoying if there is no space added, because if you
    have two lines
    hello
    world
    and add a comment after hello without space, it creates a single, misspelled
    word helloworld in the pdf.

     
  • Meho R.

    Meho R. - 2010-07-28

    Hi,

    Sorry for late reply. It's TMX 1.9.9a, on Debian. OK, I followed the
    instruction and disabled replacement key.

    benibela, your argument is valid, although I don't agree for this being
    default behaviour. People usually use % on purpose knowing what its use will
    cause, and one of the first thing it's used for is to actually remove the
    space created by new line (as in footnotes in the next line or multiline
    command definitions for which this default behaviour could even lead to
    errors).

    However, while it's easy to change the default behaviour, it's fine with me.
    Thanks for the tip, I missed key replacement completely.

     
  • Meho R.

    Meho R. - 2011-12-16

    Please, would you be kind and remind me how to do this change in TeXStudio
    2.2, since there is no replacement key entry anymore in Options > Configure TS

    Shortcuts (and I really do not have any need for "before" and "after" word
    key replacement in User Tags). Thanks.

     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2011-12-16

    only way to do it is via the user tags. It should be automatically set
    already. Any changes need to applied there.

     
  • Meho R.

    Meho R. - 2011-12-16

    But why didn't you then leave the percent sign to do what it should: type in
    "%" without space, as anyone would expect, and put those two as optional
    entries in User Tags if anyone actually needed them? I really don't want to
    hunt down and delete spaces every time I type "%", nor do I want to use
    shortcuts for something that should be done by default, with its original
    intended key.

    Is there any other key that inserts additional characters/symbols by default?

     
  • t.schreiter

    t.schreiter - 2012-02-10

    Hi,

    Where exactly can the default behavior be changed in version 2.3 (windows xp)?

    In the list Options -> Configure -> Shortcuts -> Editor is only Basic Key
    Mapping, nothing else...

     
  • Benito van der Zander

    User\User Macros\Edit User Macros

     
  • t.schreiter

    t.schreiter - 2012-02-10

    Do you mean User\User Commands\Edit User Commands?

    What exactly does one have to enter to prevent the %-key from inserting an
    additional blank character?

     
  • Benito van der Zander

    Do you mean User\User Commands\Edit User Commands?
    No.

    User\User Tags\Edit User Tags?

    Remove there what you don't need

     
  • t.schreiter

    t.schreiter - 2012-02-11

    Found it. It works.

    Thank you.

     
  • Meho R.

    Meho R. - 2012-02-19

    I'd like to ask you, guys, to give us, the users, an option to disable the
    current default behaviour of "%" (like "key replacement option" in previous
    versions of TMX). I'm using a huge number of custom commands in my daily work,
    which means extensive use of "%" key, and default "space before %" is turning
    out as a real issue (and, beside that, I'm using User Tags for other things).
    I don't mind changing an option in a config file, if there's a problem
    implementing the feature in GUI way.

     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2012-02-19

    as stated before, you just have to remove the user tags:
    User\User Tags\Edit User Tags -> remove the ones "Key replacement %:"...

     
  • Thiago

    Thiago - 2012-04-04

    Great! Now I know the reason to have a blank space between two % signs.
    I removed mine too.
    Thanks.

     
  • CLightfield

    CLightfield - 2013-01-10

    I'm still not following. "User" is not one of my main level menu items. I can only find the following "Tools\User" but there is nothing in that menu. I can only find the expression "Key replacement %" under "Macros". I would also like to remove the space inserted before the "%".

     
  • Benito van der Zander

    "User\User Tags\Edit User Tags" has been renamed to "Macros\Edit Macros"

    (this here is an very old topic)

     
    • CLightfield

      CLightfield - 2013-01-12

      Got it. Thanks!

       
  • Dominik Wujastyk

    Update for Linux Mint, June 2024:

    Go to ~/.config/texstudio/macro and find file Macro_1.txsMacro

    It's content is

    {
        "abbrev": "",
        "description": [
            ""
        ],
        "formatVersion": 2,
        "menu": "",
        "name": "Key replacement: % after word",
        "shortcut": "",
        "tag": [
            " %%"
        ],
        "trigger": "(?language:latex)(?<=\\S)%",
        "type": "Snippet"
    }
    

    Change " %%" to "%%". Save and exit.

    The other way to do this is through the TeXstudio menu "Macros / Edit Macros". Find the one called "Key replacement: % after word" and again, change %% to %%

     

Log in to post a comment.