Loading ...
Sorry, an error occurred while loading the content.

Re: Spellcheck on Tex-Files

Expand Messages
  • skeept
    ... I am having problems with misspells in tabular and multicolumn commands. So for example in begin{tabular}{rl} one & two multicolumn{2}{c}{what?}
    Message 1 of 13 , Oct 1, 2012
    • 0 Attachment
      On Tuesday, January 15, 2008 2:35:06 PM UTC-5, (unknown) wrote:
      > Hi!
      > I am using the built in spellcheck for vim 7 and I want to use it with
      > Latex-files. There are some fillips which are irritating me.
      > So, for example if I have a table defined as:
      >
      > \begin{tabular}{c}
      > ...
      >
      > The c in the brackets is highlighted as a missspelled word.
      >
      > Another one:
      >
      > %\usepackage{...}
      >
      > Usepackage is highlighted as a missspelled word.
      > I'd like to turn off the spelling correction in comments, for it is not important for Latex-documents, because that's not to see for the reader afterwards and I'd like to have the highlighting of the column setup in the tabular-statement fixed.
      >
      > How to do these?
      >
      > Tanks in advance,
      > surgeon


      I am having problems with misspells in tabular and multicolumn commands.
      So for example in
      \begin{tabular}{rl}
      one & two \\
      \multicolumn{2}{c}{what?}
      \end{tabular}

      rl and c are marked as spelling errors, but when using an array in math this does not result in an error.

      I checked the tex syntax file and it is version 73 from April 24.

      Any idea on how this can get fixed?

      Thank you.

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Charles Campbell
      ... Vim is not a LaTeX parser. I could fix this by providing syntax rules for tabulars (the syntax highlighting engine is more lexical than syntactic), but
      Message 2 of 13 , Oct 16, 2012
      • 0 Attachment
        skeept wrote:
        > On Tuesday, January 15, 2008 2:35:06 PM UTC-5, (unknown) wrote:
        >> Hi!
        >> I am using the built in spellcheck for vim 7 and I want to use it with
        >> Latex-files. There are some fillips which are irritating me.
        >> So, for example if I have a table defined as:
        >>
        >> \begin{tabular}{c}
        >> ...
        >>
        >> The c in the brackets is highlighted as a missspelled word.
        >>
        >> Another one:
        >>
        >> %\usepackage{...}
        >>
        >> Usepackage is highlighted as a missspelled word.
        >> I'd like to turn off the spelling correction in comments, for it is not important for Latex-documents, because that's not to see for the reader afterwards and I'd like to have the highlighting of the column setup in the tabular-statement fixed.
        >>
        >> How to do these?
        >>
        >> Tanks in advance,
        >> surgeon
        >
        > I am having problems with misspells in tabular and multicolumn commands.
        > So for example in
        > \begin{tabular}{rl}
        > one & two \\
        > \multicolumn{2}{c}{what?}
        > \end{tabular}
        >
        > rl and c are marked as spelling errors, but when using an array in math this does not result in an error.
        >
        > I checked the tex syntax file and it is version 73 from April 24.
        >
        > Any idea on how this can get fixed?
        >
        Vim is not a LaTeX parser. I could fix this by providing syntax rules
        for tabulars (the syntax highlighting engine is more lexical than
        syntactic), but there're many other places where LaTeX accepts things
        that are not regular text and would be flagged as spelling errors. The
        syntax/tex.vim file is already over 1200 lines long; I don't think I
        will be implementing any fixes for this.

        If this seriously annoys you, you could probably put additional syntax
        highlighting rules in a .vim/after/syntax/tex.vim file and have it
        recognize the tabulars (and whatever else you want recognized).

        Regards,
        C Campbell

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • skeept
        ... Thanks for your reply, I understand your point, but it seems that vim already tries not to check spelling in a variety of locations when editing latex
        Message 3 of 13 , Oct 16, 2012
        • 0 Attachment
          On Tuesday, October 16, 2012 11:51:23 AM UTC-4, Charles Campbell wrote:
          > skeept wrote:
          >
          > > On Tuesday, January 15, 2008 2:35:06 PM UTC-5, (unknown) wrote:
          >
          > >> Hi!
          >
          > >> I am using the built in spellcheck for vim 7 and I want to use it with
          >
          > >> Latex-files. There are some fillips which are irritating me.
          >
          > >> So, for example if I have a table defined as:
          >
          > >>
          >
          > >> \begin{tabular}{c}
          >
          > >> ...
          >
          > >>
          >
          > >> The c in the brackets is highlighted as a missspelled word.
          >
          > >>
          >
          > >> Another one:
          >
          > >>
          >
          > >> %\usepackage{...}
          >
          > >>
          >
          > >> Usepackage is highlighted as a missspelled word.
          >
          > >> I'd like to turn off the spelling correction in comments, for it is not important for Latex-documents, because that's not to see for the reader afterwards and I'd like to have the highlighting of the column setup in the tabular-statement fixed.
          >
          > >>
          >
          > >> How to do these?
          >
          > >>
          >
          > >> Tanks in advance,
          >
          > >> surgeon
          >
          > >
          >
          > > I am having problems with misspells in tabular and multicolumn commands.
          >
          > > So for example in
          >
          > > \begin{tabular}{rl}
          >
          > > one & two \\
          >
          > > \multicolumn{2}{c}{what?}
          >
          > > \end{tabular}
          >
          > >
          >
          > > rl and c are marked as spelling errors, but when using an array in math this does not result in an error.
          >
          > >
          >
          > > I checked the tex syntax file and it is version 73 from April 24.
          >
          > >
          >
          > > Any idea on how this can get fixed?
          >
          > >
          >
          > Vim is not a LaTeX parser. I could fix this by providing syntax rules
          >
          > for tabulars (the syntax highlighting engine is more lexical than
          >
          > syntactic), but there're many other places where LaTeX accepts things
          >
          > that are not regular text and would be flagged as spelling errors. The
          >
          > syntax/tex.vim file is already over 1200 lines long; I don't think I
          >
          > will be implementing any fixes for this.
          >
          >
          >
          > If this seriously annoys you, you could probably put additional syntax
          >
          > highlighting rules in a .vim/after/syntax/tex.vim file and have it
          >
          > recognize the tabulars (and whatever else you want recognized).
          >
          >
          >
          > Regards,
          >
          > C Campbell


          Thanks for your reply,

          I understand your point, but it seems that vim already tries not to check spelling in a variety of locations when editing latex files (labels, citations, \ commands...)
          I mentioned these because in my documents they are the only place left where I think the spelling should not be done, but I am sure there a a lot more for commands I am not using that would have to be added so that would be really hard.

          I would gladly put the specific rules in my after/ftplugin, but unfortunately I don't know exactly what to put there.
          Could you please tell me what specifically I would put there or point me for some files with specific examples?

          Thank you for the help.

          Jorge.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Charles Campbell
          ... unfortunately I don t know exactly what to put there. Could you please tell me what specifically I would put there or point me for some files with specific
          Message 4 of 13 , Oct 16, 2012
          • 0 Attachment
            > I would gladly put the specific rules in my after/ftplugin, but
            unfortunately I don't know exactly what to put there. Could you please
            tell me what specifically I would put there or point me for some files
            with specific examples?

            You need to recognize the regions and use add=@NoSpell with them.

            :help syn-region

            syntax/tex.vim has a number of "syn region" usages that you could use as
            an example. See "syn region DocZone" for example. You'll probably want
            to contains=@texFoldGroup, in the text region.

            Regards,
            C Campbell

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • skeept
            ... What I put in my after/ftplugin/tex.vim is syn region texTabularPos matchgroup=texSection start= begin s*{ s*tabular s*}{ end= } fold
            Message 5 of 13 , Oct 16, 2012
            • 0 Attachment
              On Tuesday, October 16, 2012 3:10:38 PM UTC-4, Charles Campbell wrote:
              > > I would gladly put the specific rules in my after/ftplugin, but
              >
              > unfortunately I don't know exactly what to put there. Could you please
              >
              > tell me what specifically I would put there or point me for some files
              >
              > with specific examples?
              >
              >
              >
              > You need to recognize the regions and use add=@NoSpell with them.
              >
              >
              >
              > :help syn-region
              >
              >
              >
              > syntax/tex.vim has a number of "syn region" usages that you could use as
              >
              > an example. See "syn region DocZone" for example. You'll probably want
              >
              > to contains=@texFoldGroup, in the text region.
              >
              >
              >
              > Regards,
              >
              > C Campbell

              What I put in my after/ftplugin/tex.vim is
              syn region texTabularPos matchgroup=texSection start='\\begin\s*{\s*tabular\s*}{' end='}' fold contains=@texFoldGroup,@texDocGroup

              but it doesn't seem to work (I still see the the word marked as a miss spell).

              I also defined the following map
              map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
              \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
              \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
              from
              http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor

              and when I use it in the region I am interested I see
              hi<texSectionZone> trans<

              so I guess the region is not correctly defined.
              Any input is appreciated.

              Regards,

              Jorge

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • xxx
              ... I would really appreciate a specific example on how to acomplish this. My last try is syn region texComment matchgroup=texStatement start= {tabular}{
              Message 6 of 13 , Oct 24, 2012
              • 0 Attachment
                On Tuesday, October 16, 2012 10:47:54 PM UTC-4, skeept wrote:
                > On Tuesday, October 16, 2012 3:10:38 PM UTC-4, Charles Campbell wrote:
                >
                > > > I would gladly put the specific rules in my after/ftplugin, but
                >
                > >
                >
                > > unfortunately I don't know exactly what to put there. Could you please
                >
                > >
                >
                > > tell me what specifically I would put there or point me for some files
                >
                > >
                >
                > > with specific examples?
                >
                > >
                >
                > >
                >
                > >
                >
                > > You need to recognize the regions and use add=@NoSpell with them.
                >
                > >
                >
                > >
                >
                > >
                >
                > > :help syn-region
                >
                > >
                >
                > >
                >
                > >
                >
                > > syntax/tex.vim has a number of "syn region" usages that you could use as
                >
                > >
                >
                > > an example. See "syn region DocZone" for example. You'll probably want
                >
                > >
                >
                > > to contains=@texFoldGroup, in the text region.
                >
                > >
                >
                > >
                >
                > >
                >
                > > Regards,
                >
                > >
                >
                > > C Campbell
                >
                >
                >
                > What I put in my after/ftplugin/tex.vim is
                >
                > syn region texTabularPos matchgroup=texSection start='\\begin\s*{\s*tabular\s*}{' end='}' fold contains=@texFoldGroup,@texDocGroup
                >
                >
                >
                > but it doesn't seem to work (I still see the the word marked as a miss spell).
                >
                >
                >
                > I also defined the following map
                >
                > map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
                >
                > \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
                >
                > \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
                >
                > from
                >
                > http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor
                >
                >
                >
                > and when I use it in the region I am interested I see
                >
                > hi<texSectionZone> trans<
                >
                >
                >
                > so I guess the region is not correctly defined.
                >
                > Any input is appreciated.
                >
                >
                >
                > Regards,
                >
                >
                >
                > Jorge


                I would really appreciate a specific example on how to acomplish this.
                My last try is
                syn region texComment matchgroup=texStatement start='{tabular}{' end='}'
                \ contains=@NoSpell

                but it doesn't work...

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Charles E Campbell Jr
                ... You almost had it earlier; you need to have your new region contained in texDocZone: syn region texTabularPos matchgroup=texStatement
                Message 7 of 13 , Oct 31, 2012
                • 0 Attachment
                  xxx wrote:
                  > I would really appreciate a specific example on how to acomplish this.
                  > My last try is syn region texComment matchgroup=texStatement
                  > start='{tabular}{' end='}' \ contains=@NoSpell but it doesn't work...
                  You almost had it earlier; you need to have your new region contained in
                  texDocZone:

                  syn region texTabularPos matchgroup=texStatement
                  start='\\begin\s*{\s*tabular\s*}{' end='}' fold
                  contains=@texFoldGroup,@texDocGroup,@NoSpell containedin=texDocZone

                  That may not be the only region that it needs to be contained in, however.

                  I use my :HLT! command available with my plugin hilinks.vim:
                  http://www.drchip.org/astronaut/vim/index.html#HILINKS

                  Then you can move your cursor around and determine which syntax region
                  is currently active under the cursor.

                  Regards,
                  C Campbell

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • skeept
                  ... Thank you very much! With the help of your plugin HILINKS and your last suggestion I was finally able to get it to work. The version I have in my config
                  Message 8 of 13 , Nov 1, 2012
                  • 0 Attachment
                    On Wednesday, October 31, 2012 5:45:57 PM UTC-4, DrChip wrote:
                    > xxx wrote:
                    >
                    > > I would really appreciate a specific example on how to acomplish this.
                    >
                    > > My last try is syn region texComment matchgroup=texStatement
                    >
                    > > start='{tabular}{' end='}' \ contains=@NoSpell but it doesn't work...
                    >
                    > You almost had it earlier; you need to have your new region contained in
                    >
                    > texDocZone:
                    >
                    >
                    >
                    > syn region texTabularPos matchgroup=texStatement
                    >
                    > start='\\begin\s*{\s*tabular\s*}{' end='}' fold
                    >
                    > contains=@texFoldGroup,@texDocGroup,@NoSpell containedin=texDocZone
                    >
                    >
                    >
                    > That may not be the only region that it needs to be contained in, however.
                    >
                    >
                    >
                    > I use my :HLT! command available with my plugin hilinks.vim:
                    >
                    > http://www.drchip.org/astronaut/vim/index.html#HILINKS
                    >
                    >
                    >
                    > Then you can move your cursor around and determine which syntax region
                    >
                    > is currently active under the cursor.
                    >
                    >
                    >
                    > Regards,
                    >
                    > C Campbell

                    Thank you very much!
                    With the help of your plugin HILINKS and your last suggestion I was finally able to get it to work.
                    The version I have in my config file (which I would not be able to write without your plugin) is:

                    syn region texTabularPos matchgroup=texStatement
                    \ start='\\begin\s*{\s*tabular\s*}[^}]*{' end='}' fold
                    \ contains=@texFoldGroup,@texDocGroup,@NoSpell
                    \ containedin=texDocZone,texChapterZone,texSectionZone,texSubSectionZone

                    Since I got this far, I would ask a related question.
                    Some authors names are first classified as bad spelling. For some names, say
                    Al-Faiz both words Al and Faiz are spelling errors. They are actually a name but unless they appear together this should be a bad spelling.
                    An idea I have is to define a command
                    \nospell and then when writing the name I would just write \nospell{Al-Faiz} and then I could instruct vim not to spell that region, using a technique similar to the above one.
                    Any idea on this?

                    Thanks!

                    --
                    You received this message from the "vim_use" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                  • Charles Campbell
                    ... Glad you could get it to work. If you can live with - signs in your keyword (see :help isk ), then making names part of a keyword list (and
                    Message 9 of 13 , Nov 2, 2012
                    • 0 Attachment
                      skeept wrote:
                      > Thank you very much! With the help of your plugin HILINKS and your
                      > last suggestion I was finally able to get it to work. The version I
                      > have in my config file (which I would not be able to write without
                      > your plugin) is: syn region texTabularPos matchgroup=texStatement \
                      > start='\\begin\s*{\s*tabular\s*}[^}]*{' end='}' fold \
                      > contains=@texFoldGroup,@texDocGroup,@NoSpell \
                      > containedin=texDocZone,texChapterZone,texSectionZone,texSubSectionZone
                      > Since I got this far, I would ask a related question. Some authors
                      > names are first classified as bad spelling. For some names, say
                      > Al-Faiz both words Al and Faiz are spelling errors. They are actually
                      > a name but unless they appear together this should be a bad spelling.
                      > An idea I have is to define a command \nospell and then when writing
                      > the name I would just write \nospell{Al-Faiz} and then I could
                      > instruct vim not to spell that region, using a technique similar to
                      > the above one. Any idea on this? Thanks!
                      Glad you could get it to work.

                      If you can live with "-" signs in your keyword (see :help 'isk'), then
                      making names part of a keyword list (and contains=@NoSpell) should
                      work. Keywords are the fastest (using a hashing method for recognition)
                      plus have top priority (so you won't need to worry about the
                      containedin=... list).

                      Regards,
                      Chip Campbell

                      --
                      You received this message from the "vim_use" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php
                    • skeept
                      ... Thanks for the suggestion, I have thought about that before but I prefer not to add - to iskeyword. I did add : which makes completion for references
                      Message 10 of 13 , Nov 3, 2012
                      • 0 Attachment
                        On Friday, November 2, 2012 9:50:51 AM UTC-4, Charles Campbell wrote:
                        > skeept wrote:
                        >
                        > > Thank you very much! With the help of your plugin HILINKS and your
                        >
                        > > last suggestion I was finally able to get it to work. The version I
                        >
                        > > have in my config file (which I would not be able to write without
                        >
                        > > your plugin) is: syn region texTabularPos matchgroup=texStatement \
                        >
                        > > start='\\begin\s*{\s*tabular\s*}[^}]*{' end='}' fold \
                        >
                        > > contains=@texFoldGroup,@texDocGroup,@NoSpell \
                        >
                        > > containedin=texDocZone,texChapterZone,texSectionZone,texSubSectionZone
                        >
                        > > Since I got this far, I would ask a related question. Some authors
                        >
                        > > names are first classified as bad spelling. For some names, say
                        >
                        > > Al-Faiz both words Al and Faiz are spelling errors. They are actually
                        >
                        > > a name but unless they appear together this should be a bad spelling.
                        >
                        > > An idea I have is to define a command \nospell and then when writing
                        >
                        > > the name I would just write \nospell{Al-Faiz} and then I could
                        >
                        > > instruct vim not to spell that region, using a technique similar to
                        >
                        > > the above one. Any idea on this? Thanks!
                        >
                        > Glad you could get it to work.
                        >
                        >
                        >
                        > If you can live with "-" signs in your keyword (see :help 'isk'), then
                        >
                        > making names part of a keyword list (and contains=@NoSpell) should
                        >
                        > work. Keywords are the fastest (using a hashing method for recognition)
                        >
                        > plus have top priority (so you won't need to worry about the
                        >
                        > containedin=... list).
                        >
                        >
                        >
                        > Regards,
                        >
                        > Chip Campbell


                        Thanks for the suggestion, I have thought about that before but I prefer not to add - to iskeyword. I did add : which makes completion for references easier (so I can type eqn:<C-N> and have a list of possible words starting with eqn:)

                        Regards,
                        Jorge Rodrigues

                        --
                        You received this message from the "vim_use" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php
                      Your message has been successfully submitted and would be delivered to recipients shortly.