SublimeText / LaTeXTools

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

Math Preview Hover Option #914

Open tsiper opened 8 years ago

tsiper commented 8 years ago

Thanks a lot for the math and image preview features, they're awesome! Could you please add an option for the math preview to be displayed on a pop-up while hovering, similar to the image pop-up mechanism?

r-stein commented 8 years ago

In the current mechanism it is either hover popup or phantom. Since images are static a hover popup seems to be the best option there. However math should be previewed while editing, which is best done by a phantom. Therefore I did/do not see a popup to be useful enough to implement it.

skulumani commented 8 years ago

Hello @r-stein,

Thanks for the great work on the plugin. I have to disagree with your opinion on the hover option. It's now quite irritating to be typing an equation and having the preview constantly updating. In addition, as a user I'm more than capable of writing the equation and then looking at the preview when I'm done rather than during a half complete equation.

Another argument is that LaTeX is meant to separate the document preparation from the typesetting. Having a constantly updating preview seems to defeat this main benefit.

Furthermore, the preview is somewhat taxing on my older and much less capable laptop. One of the reasons I'm using Sublime/LaTeXTools in the first place is to have a lightweight, but feature rich, document editor.

In my view, the default state should be the hover option for both images and equations. For those users who require a constant reminder of the equation they're typing, they can then change the setting to display all/selected.

In the end, I agree with @Crazy-Ape and think there should be a hover option for the math preview as well.

Regardless, I'm grateful for the great plugin and love all the great features everyone is adding. Thank you for the hard work.

r-stein commented 8 years ago

@skulumani Okay, that is a workflow I didn't think about and you have valid points. I will add this to my TODO list =)

skulumani commented 8 years ago

No worries @r-stein.

I appreciate all the great work! It's amazing to open my document every day and see some new exciting updates from LaTeXTools!

On Thu, Nov 3, 2016 at 2:55 PM Richard Stein notifications@github.com wrote:

@skulumani https://github.com/skulumani Okay, that is a workflow I didn't think about and you have valid points. I will add this to my TODO list =)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/914#issuecomment-258240396, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBaZgbp4us0uSYJ6Q-dXZrmrAcvG7l8ks5q6i4egaJpZM4KoI9U .

r-stein commented 8 years ago

@skulumani Aside: if you have a older laptop you can decrease the number of preview threads in the settings file

xiaohk commented 8 years ago

I am wondering how to trigger off the auto-preview feature please?

skulumani commented 8 years ago

In the latex tools settings there's an option for math preview mode. Set it to none.

On Mon, Nov 7, 2016, 18:57 Jay Wong notifications@github.com wrote:

I am wondering how to trigger off the auto-preview feature please?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/914#issuecomment-259002689, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBaZtYLFGUKUbo4LaL71ZjhhwAjzWlwks5q77rPgaJpZM4KoI9U .

xiaohk commented 8 years ago

@skulumani Thank you, is that option in the settings-user, and what is the name of that option please? I couldn't find options like math, or preview.

skulumani commented 8 years ago

It's art of the latex tools settings

Go to package settings then latex tools settings

I'm not on my computer currently but can provide more exact details later if you can't find it

On Mon, Nov 7, 2016, 19:10 Jay Wong notifications@github.com wrote:

@skulumani https://github.com/skulumani Thank you, is that option in the settings-user, and what is the name of that option please? I couldn't find options like math, or preview.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/914#issuecomment-259005110, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBaZhqgg4WYj720XjXUPrLc-aep8sEBks5q7730gaJpZM4KoI9U .

xiaohk commented 8 years ago

@skulumani Yeah, I went to the user settings of latextool, but I couldn't find it. Thanks for you help!

// LaTeXTools Preferences
//
// Keep in the User directory. Personalize as needed

{

// ------------------------------------------------------------------
// General settings
// ------------------------------------------------------------------

    // Cite/ref autocompletion by default is triggered after e.g. \ref{. If you don't like this,
    // set to false. You can also use toggles: C-l,t,a,c and C-l,t,a,r.
    "cite_auto_trigger": true,
    "ref_auto_trigger": true,
    // Sometimes a \ref is preceded by an open parenthesis.
    // By default, we do not close the parenthesis after completion
    // But, if you want us to, set this to true.
    "ref_add_parenthesis": false,

    // Fill-helper autocompletion triggered for a wide range of references to external
    // files. You can also use toggle: C-l,t,a,f
    "fill_auto_trigger": true,

    // Fill-helper autocompletion trigger for environment names after \begin{ and \end{
    // this requires the LaTeX-cwl package and might not have a complete list of all environments.
    // You can also use toggle: C-l,t,a,e
    "env_auto_trigger": false,

    // Keep focus on Sublime Text after building (true) or switch to PDF viewer (false)
    // If you are on Windows or Linux and using ST2, you may need to set the
    // "sublime_executable" setting for this to work in your platform settings.
    "keep_focus": true,
    // Sync PDF to current editor position after building (true) or not
    "forward_sync": true,

    // When to trigger cwl-command completion (requires the LaTeX-cwl package)
    // possible values are:
    // "always" (always show command completions)
    // "prefixed" (default, show command completions if the current word is prefixed with '\')
    // "never" (never show command completions)
    "command_completion": "prefixed",

    // level to hide the build panel after the build is finished
    // Possible values are:
    // "always" (hide the panel even if the build failed),
    // "no_errors" (only hide the panel if the build was successful even with warnings),
    // "no_warnings" (only hide the panel if no warnings occur)
    // "no_badboxes" (only hide the panel if no badbox messages occur when badboxes are enabled) and
    // "never" (default, never hide the build panel)
    "hide_build_panel": "never",

    // controls whether or not to display any bad boxes in the build output
    // if this is not set to true, "no_badboxes" for "hide_build_panel" is
    // equivalent to "no_warnings"
    "display_bad_boxes": false,

    // valid texfile extensions
    "tex_file_exts": [".tex"],

    // controls whether or not syntax is automatically set to LaTeX for
    // files that match one of the configured `tex_file_exts`
    "latextools_set_syntax": true,

    // the mapping from the locales to the dictionaries for the 
    // `%!TEX spellcheck` directive, where the locales must be all lowercase
    // and separated by a minus sign (-). The dictionaries must be valid path
    // and compatible with the ST integrated spellcheck
    // e.g.
    // { "en-en": "Packages/Language - English/en_GB.dic" }
    "tex_spellcheck_paths": {},

// ------------------------------------------------------------------
// Temporary file settings
// ------------------------------------------------------------------
    // Ends of the names of temporary files to be deleted
    "temp_files_exts": [
        ".blg",".bbl",".aux",".log",".brf",".nlo",".out",".dvi",".ps",
        ".lof",".toc",".fls",".fdb_latexmk",".pdfsync",".synctex.gz",
        ".ind",".ilg",".idx"
    ],
    // Folders that are not traversed when deleting temp files
    "temp_files_ignored_folders": [
        ".git", ".svn", ".hg"
    ],

// ------------------------------------------------------------------
// Platform settings: adapt as needed for your machine
// ------------------------------------------------------------------

    "osx":  {
        // Path used when invoking tex & friends; MUST include $PATH
        "texpath" : "$PATH:/Library/TeX/texbin:/usr/texbin:/usr/local/bin:/opt/local/bin"
        // Path to PDF viewer, if needed
        // TODO think about it. Also, maybe configure it here!
    },

    "windows": {
        // Path used when invoking tex & friends; "" is fine for MiKTeX
        // For TeXlive 2011 (or other years) use
        // "texpath" : "C:\\texlive\\2011\\bin\\win32;$PATH",
        "texpath" : "",
        // TeX distro: "miktex" or "texlive"
        "distro" : "miktex",
        // Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH)
        "sumatra": "",
        // Command to invoke Sublime Text. Used if the keep_focus toggle is true.
        // If blank, "subl.exe" or "sublime_text.exe" will be used.
        "sublime_executable": "",
        // how long (in seconds) to wait after the jump_to_pdf command completes
        // before switching focus back to Sublime Text. This may need to be
        // adjusted depending on your machine and configuration.
        "keep_focus_delay": 0.5
    },

    "linux" : {
        // Path used when invoking tex & friends; MUST include $PATH
        "texpath" : "$PATH:/usr/texbin",
        // Command to invoke Python. Useful if you have Python installed in a
        // non-standard location or want to use a particular version of python.
        // Both Python2 and Python3 are supported, but must have the DBus bindings
        // installed.
        "python": "",
        // The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
        // available for ST2; adjust as needed for other platforms, and for ST3
        "sublime": "sublime-text",
        // How long to wait after evince or okular has launched before sending a sync message
        // in seconds, floating point; choose 2.0 or 3.0 on a slower machine, 0.5 on a fast one
        // Note: only tweak this if sync after launching the PDF viewer does not seem to work,
        // or if the PDF viewer opens instantly and you don't want to wait.
        // Default: 1.5 (works on my MBP4,1...)
        "sync_wait": 1.5,
        // Command to invoke Sublime Text. Used if the keep_focus toggle is true.
        // If blank, "subl" or "sublime_text" will be used.
        "sublime_executable": "",
        // how long (in ms) to wait after the jump_to_pdf command completes
        // before switching focus back to Sublime Text. This may need to be
        // adjusted depending on your machine and configuration.
        "keep_focus_delay": 0.5
    },

// ------------------------------------------------------------------
// Build engine settings
// ------------------------------------------------------------------

    // OPTION: "builder"
    // Specifies a build engine
    // Possible values:
    //
    // "default" or ""  the default built-in build engine; currently
    //                  this is the same as "traditional"
    //
    // "simple"         invokes pdflatex 1x or 2x as needed, then
    //                  bibtex and pdflatex again if needed;
    //                  intended mainly as a simple example for
    //                  people writing their own build engines.
    //
    // "traditional"    replicates the 'old' system based on
    //                  latexmk (TeXLive) / texify (MiKTeX)
    //
    // "script"         external script: invokes the set of commands
    //                  specified in the "script_commands" setting 
    //                  in the platform-specific part of the 
    //                  "builder_settings"
    //
    // custom name      you can also use third-party build engines;
    //                  if so, set the "builder_path" option below
    //
    // NOTE: custom builders CANNOT have the same name as an existing
    // built-in build engine (including "default")

    "builder": "traditional",

    // OPTION: "builder_path"
    // If non-empty, specifies a path to a custom builder, relative to the
    // Sublime Text Packages directory.
    // For instance, "User/builders" (on Windows: "User\builders") is a good
    // choice if you roll your own.
    // (Note: if you choose "User", you may get a Python import error in the
    // console, but things will still work).
    // Leave empty ("") for a built-in builder.

    "builder_path": "",

    // OPTION: "builder_settings"
    // Specify builder-dependent settings and preferences
    // Possible values: see README or documentation provided with
    // third-party build engine.
    // Builder setting can be general or OS-dependent

    "builder_settings" : {

        // General settings:
        // See README or third-party documentation

        // (built-ins): true shows the log of each command in the output panel
        "display_log" : false,

        // Platform-specific settings:
        "osx" : {
            // See README or third-party documentation
        },

        "windows" : {
            // See README or third-party documentation
        },

        "linux" : {
            // See README or third-party documentation
        },
        // Set shell -escape as parameter so python.sty can work (by Jay)
        "options" : ["--shell-escape"]

        // Try to solve the problem which the file using fontspect cannot be 
        // complied
        //"program": "xelatex"
    },

// ------------------------------------------------------------------
// Viewer settings
// ------------------------------------------------------------------
    // OPTION: "viewer"
    // Specifies which viewer to use
    // Possible values:
    //
    // "default" or ""  the default viewer for your platform, which 
    //                  is sumatra on Windows, skim on OS X and
    //                  evince on linux
    //
    // "command"        invokes a viewer based on commands configured
    //                  in viewer settings below; see the README
    //                  for details
    //
    // "evince"         uses Evince; this is the default on linux
    //
    // "okular"         uses Okular to open the pdf
    //
    // "preview"        uses Preview.app to open the pdf
    //
    // "skim"           uses Skim to open the pdf; this is the
    //                  default on OSX
    //
    // "sumatra"        uses SumatraPDF; this is the default on
    //                  Windows
    "viewer": "preview",

    // OPTION: "viewer_settings"
    // Specify viewer-dependent settings and preferences
    // Possible values: see README or documentation provided with
    // third-party viewer.
    // Viewer settings can be general or OS-dependent
    "viewer_settings": {
        // Platform-specific settings:
        "osx" : {
            // See README or third-party documentation
        },

        "windows" : {
            // See README or third-party documentation
        },

        "linux" : {
            // See README or third-party documentation
        }
    },

// ------------------------------------------------------------------
// Opening files included into the tex source code
// ------------------------------------------------------------------

    // image types you use in latex
    // these types will be used for autocompletion and
    // opening of included images, when no extension is written
    "image_types": ["png", "pdf", "jpg", "jpeg", "eps"],

    // the commands to open image files. The extensions will be matched from top to bottom.
    // If no extension is given, all extensions will be matched.
    // If there is no match the image will be opened with Sublime Text.
    // the extension:
    //      can either be a string for one extension
    //      or an array of string to match more than one extensions.
    // the command:
    //      can be the name to start the programm. The image file will be passed
    //          as the argument.
    //      can be a string as a command with args:
    //          e.g. "open -a PixelMator", in this case the file will be appended
    //          if the position is relevant use "$file" in the string
    //          e.g. "open -a PixelMator $file"
    //          this will be substituted by the path to the file
    "open_image_command": {
        "osx" : [
            {
                // open pdf and eps documents with skim
                "extension": ["pdf", "eps"],
                "command": "open -a Skim.app"
            }
            // uncomment these lines to open all other images with the default programm
            // ,
            // {
            //  "command": "open"
            // }
        ],

        // You might want to use "start" for the default programm used by Windows.
        "windows": [
            {
                // open pdf and eps documents with sumatra (it has to be on your PATH)
                "extension": ["pdf", "eps"],
                "command": "SumatraPDF"
            }
            // uncomment these lines to open all other images with the default programm
            // ,
            // {
            //  "command": "start"
            // }
        ],

        "linux": [
            {
                // open pdf documents with evince
                "extension": "pdf",
                "command": "evince"
            }
            // uncomment these lines to open all other images with the default programm
            // ,
            // {
            //  "command": "xdg-open"
            // }
        ]
    },

// ------------------------------------------------------------------
// Bibliographic references
// ------------------------------------------------------------------
    // OPTION: "bibliography"
    // Either a single  bibliography plugin to use or a list of plugins 
    // which will be executed in order, stopping after the first result
    // found
    //
    // Possible values:
    //
    // "traditional_bibliography"       the default, regex-based bibliography
    //                                  parsing
    //
    // "new_bibliography"               a newer parser which supports UTF-8 and
    //                                  additional fields, but may be slower and
    //                                  less well tested.
    "bibliography": "traditional_bibliography",

    /* This preference sets the format of the quick panel to select citations using wildcards.
    The setting is a list with one or two string using wildcards for author, title, keyword etc.

    Default setting: the traditional display, `["{title} ({keyword})","{author}"]`
    Format:
    Can quantum-mechanical description of physical reality be considered complete? This is an non-existing subtitle to illustrate (einstein1935quantum)
    Albert Einstein and B Podolsky and N Rosen

    Richer alternative: ["{author_short} {year} - {title_short} ({keyword})","{title}"]
    Format:
    Einstein et al. 1935 - Can quantum-mechanical description of physical reality be considered complete (einstein1935quantum)
    Can quantum-mechanical description of physical reality be considered complete? This is an non-existing subtitle to illustrate

    Another alternative: ["({keyword}) {author_short} - {year}","{title} - {journal}"]
    Format:
    (einstein1935quantum) Einstein et al. - 1935
    Can quantum-mechanical description of physical reality be considered complete? - Physical Review

    No-title alternative: ["{author_short} {year} ({keyword})"]
    Format:
    Einstein et al. 1935 (einstein1935quantum)

    Valid wildcards: keyword, title, author, year, author_short, title_short, journal
    */

    // Uncomment or modify at will
    "cite_panel_format": ["{author_short} {year} - {title_short} ({keyword})","{title}"],
    //"cite_panel_format": ["({keyword}) {author_short} - {year}","{title} - {journal}"],
    //"cite_panel_format": ["{author_short} {year} ({keyword})"],

    // Similarly, the formatting for the autocomplete panel:
    "cite_autocomplete_format": "{keyword}: {title}",

// ------------------------------------------------------------------
// Cache options
// ------------------------------------------------------------------

    // whether the local cache should be hidden in the sublime cache path (true)
    // or in the same directory as the root file (false)
    "hide_local_cache": true,
    /* The life-span of the local cache.
    After this life-span the local cache will automatically be invalidated and refreshed.
    You can invalidate the cache manually by removing all temporary files `C-l,backspace`.
    If the value is smaller then the functionalities are more up-to-date,
    but more recalculations might decrease the performance.

    The format is "X d X h X m X s", where X is a natural number
    "s" stands for seconds, "m" for minutes, "h" for hours, and "d" for days.
    Missing fields will be treated as 0 and white-spaces are optional.
    Hence you can write "1 h 30 m" to refresh the cached data every one and a half hours.
    If the string is invalid the default value (30 minutes) will be used.
    If you use `infinite` the cache will not invalidated automatically.
    */
    "local_cache_life_span": "30 m"
}
skulumani commented 8 years ago

@xiaohk I remember now. It seems that the settings were updated by LatexTools. There seems to be a migrate settings function in Latextools but I couldn't figure out how to get it to work.

Instead I simply backed up my personal latextools user settings and then reset the latextools settings to the default.

This should populate the settings file with the new options. You can then update with your backup.

xiaohk commented 8 years ago

@skulumani Following your instruction, I can see the option now! Thank you so much!

r-stein commented 8 years ago

Actually you can just open the Default settings and copy the corresponding entries to the User settings. When Sublime Text searches for a setting it first looks into the User settings and if not present in the Default settings.

z-m-k commented 6 years ago

I think there should be a mixed option of hover and select as well. Use case: editing an equation while looking up something from a previous equation.

r-stein commented 6 years ago

The issue with mixin is that it becomes ugly if you have a phantom and a pop-up on the same equation. On different equations it also looks not quite right.

quantumgolem commented 4 years ago

I would like to put forward my support for this idea