SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 362 forks source link

Double quotes converted into two apostrophes #1391

Open WillPainter opened 5 years ago

WillPainter commented 5 years ago

When trying to type set an umlauted character (\"o) the double quote character is automatically converted into two apostrophes "->''. While identical in text, the \"o command fails as with two apostrophes you get {'}' which does not umlaut the following character. How can I turn off this automatic conversion from double quote to two apostrophes?

r-stein commented 5 years ago

The " keybinding is in my knowledge not bound by LaTeXTools. This behavior may come from a different package. Can you open View > Show Console afterwards insert sublime.log_commands(True). Then press try to insert " into a LaTeX document to check which commands are executed.

WillPainter commented 5 years ago

The resulting log indicates:

>>> sublime.log_commands(True) command: drag_select {"event": {"button": 1, "x": 228.0, "y": 823.428571429}} command: insert_snippet {"contents": "``$0''"}

I have not installed other packages for Sublime3 and this replacement does not occur in other 'highlighting' modes (c++, undefined, python, ...) so I think it is tied to this snippet and the latex specific environment.

r-stein commented 5 years ago

Yes, it is related to LaTeX, but still might come from a different package.

Nonetheless you can open Preferences > Key Bindings and then on the right side at this to overwrite that behavior:

    // just insert " inside latex files
    { "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context":
        [
            { "key": "setting.command_mode", "operator": "equal", "operand": false },
            {"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
        ]
    },

I.e. if this is the only keybinding:

[
    // just insert " inside latex files
    { "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context":
        [
            { "key": "setting.command_mode", "operator": "equal", "operand": false },
            {"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
        ]
    },
]

Aside from that: Are you aware that you can just write ä, ö, ü,... by using the inputenc package?

\documentclass{...}
...

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}

...
WillPainter commented 5 years ago

I am using a US international keyboard and do not have umlauted characters natively. These packages are already included in my preamble however the bibtex compilation throws a lot of errors when using these special characters. This could be another bug in my local install/setup.

On Wed, 30 Jan 2019, 19:23 Richard Stein <notifications@github.com wrote:

Yes, it is related to LaTeX, but still might come from a different package.

Nonetheless you can open Preferences > Key Bindings and then on the right side at this to overwrite that behavior:

// just insert " inside latex files

{ "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context":

  [

      { "key": "setting.command_mode", "operator": "equal", "operand": false },

      {"key": "selector", "operator": "equal", "operand": "text.tex.latex"},

      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }

  ]

},

I.e. if this is the only keybinding:

[

// just insert " inside latex files

{ "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context":

  [

      { "key": "setting.command_mode", "operator": "equal", "operand": false },

      {"key": "selector", "operator": "equal", "operand": "text.tex.latex"},

      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }

  ]

},

]

Aside from that: Are you aware that you can just write ä, ö, ü,... by using the inputenc package?

\documentclass{...}

...

\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}

\usepackage{lmodern}

\usepackage[ngerman]{babel}

...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1391#issuecomment-459053076, or mute the thread https://github.com/notifications/unsubscribe-auth/As_iY-ithHuY-9kxqxT7bazkwQ2uOsGYks5vIeMVgaJpZM4aaCVP .