warmdev / SublimeOutline

Outline view for Sublime Text 3
MIT License
66 stars 23 forks source link

Latex Outline #2

Closed tsiper closed 7 years ago

tsiper commented 7 years ago

Hi, I think this plugin is a great idea, and excellent implementation! :+1:

Could you please add support for correct latex outlines, that has sections/subsections and labels indented correctly.

warmdev commented 7 years ago

Content and indentation of the outline are determined by the corresponding tmPreferences files in the default Latex package. To modify these files, I recommend using the PackageResourceViewer package (available from Package Control). Once you have installed PackageResourceViewer, press ctrl + shift + p and then PackageResourceViewer: Open Resource, then navigate to or find the LaTeX package, then open each of the following files:

Commands

To hide commands from Outline, in file Symbol List - Commands.tmPreferences, change the value below showInSymbolList from 1 to 0.

Labels

To hide labels from Outline, in file Symbol List - Labels.tmPreferences, change the value below showInSymbolList from 1 to 0.

Sections

To have proper indentation for section titles, change the string section below symbolTransformation to the content below:

            s/^\\part(.*)/\U($1)/g;             # Strip \part and make rest of string uppercase
            s/^\\chapter//g;                    # Strip \chapter
            s/^\\section/  /g;                  # Strip \section + add indent
            s/^\\subsection/    /g;             # Strip \subsection + add indent
            s/^\\subsubsection/      /g;        # Strip \subsubsection + add indent
            s/^\\paragraph/        /g;          # Strip \paragraph + add indent
            s/^\\subparagraph/          /g;     # Strip \subparagraph + add indent
            s/^(\s*)\*{0,1}\{(.*)\}\s*/$1$2/g; # Keep indent and string; strip other markup

After completing the above steps and saving the files, you should get proper indentation in the Outline view. Note that PackageResourceViewer automatically saves a new copy of the files in your user folder without modifying the original files. If for some reason you want to revert your changes, just go to the User folder of Sublime Text, and delete relevant files.

Full credits to https://github.com/alehandrof/BetterGoTo for these modifications.

tsiper commented 7 years ago

Thanks! Excellent! :-)

On Wed, Oct 26, 2016 at 9:47 PM, warmdev notifications@github.com wrote:

Content and indentation of the outline are determined by the corresponding tmPreferences files in the default Latex package. To modify these files, I recommend using the PackageResourceViewer package (available from Package Control). Once you have installed PackageResourceViewer, press ctrl

  • shift + p and then PackageResourceViewer: Open Resource, then navigate to or find the LaTeX package, then open each of the following files:
    • Symbol List - Commands.tmPreferences
    • Symbol List - Labels.tmPreferences
    • Symbol List - Sections.tmPreferences

Commands

To hide commands from Outline, in file Symbol List - Commands.tmPreferences, change the value below showInSymbolList from 1 to 0. Labels

To hide labels from Outline, in file Symbol List - Labels.tmPreferences, change the value below showInSymbolList from 1 to 0. Sections

To have proper indentation for section titles, change the string section below symbolTransformation to the content below:

        s/^\\part(.*)/\U($1)/g;             # Strip \part and make rest of string uppercase
        s/^\\chapter//g;                    # Strip \chapter
        s/^\\section/  /g;                  # Strip \section + add indent
        s/^\\subsection/    /g;             # Strip \subsection + add indent
        s/^\\subsubsection/      /g;        # Strip \subsubsection + add indent
        s/^\\paragraph/        /g;          # Strip \paragraph + add indent
        s/^\\subparagraph/          /g;     # Strip \subparagraph + add indent
        s/^(\s*)\*{0,1}\{(.*)\}\s*/$1$2/g; # Keep indent and string; strip other markup

After completing the above steps, you should get proper indentation in the Outline view.

Full credits to https://github.com/alehandrof/BetterGoTo for these modifications.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/warmdev/SublimeOutline/issues/2#issuecomment-256441587, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_r7iyxKmxNQ8gNK9TF1r3aZ_5nwWLnks5q36A_gaJpZM4Kg-As .