-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex for jumping to section from TOC #192
Comments
This is probably part of a solution, yes. However, the problem is slightly more difficult. The reason is that the TOC is based on the aux file, not the tex file. The section titles are parsed from the aux file, and the titles may have been parsed by various packages and similar. I think the best way to go to make the TOC selections work for complicated section titles is to rewrite the TOC parser, such that it parses the tex file. This requires more work, though, but I might be able to do it some time soon. This should also make the TOC functionality work also when the manuscript has not been compiled. |
Ok, this I did not know about. Parsing the tex files given by file.tex.latexmain is the safest solution. In the meanwhile, the section title appearing in the .aux file are not too different from the .tex files. Apparently white spaces are added before |
Yes, it is important to parse the main tex file. And true, there are whitespaces added before In any case, I am working on this. There are more challenges, though, such that counting the numers for the section (this is given in the aux file). So the tex file parsing is not straightforward, but I think I will be able to implement it. I am working on this in my own "version" of LaTeX-Box, which you may find here. When I am done I will port it to LaTeX-Box as well. In the mean time, I hope you can live with the less than optimal version of the TOC window as it exists now. Or you can try to add the regex as you propose yourself. |
Ok, so if 'title' is the literal section title, then the regex First
and afterwards
where AddHatSpaces inserts |
I noticed your LaTeX-Box fork and I would prefer it to LateX-Box itself as it is more minimalist. I am also using Neosnippet and Neocomplete. Unfortunately, somewhat hidden in the documentation, you mention that your fork dropped Windows support, the OS I am currently using... I think you should put it in the Readme.md. |
Thanks, yes, that would be good to put in the README. Btw: If your willing to assist, then I might consider adding support for windows. The main reason I dropped support is that I do not use windows myself, and so development becomes difficult since I can't test. I don't think it should be that difficult. Most of the code already exist in LaTeX-Box, I only need to find a clever way to make the code well structured. Edit: If you are interested, then I would appreciate if you could open an issue with vim-latex to continue the discussion. |
I've just pushed an update to vim-latex with a new TOC system that only parses tex files. I am tempted to update the TOC system in LaTeX-Box as well, but it is not very well tested yet. Therefore I might wait some time before I update LaTeX-Box. |
Jumping from the TOC to a section whose title contains nested braces does not always work in LatexBox. How about using the following RegEx to spot the section title:
Say we are looking for a
\section
whose title is the stringtitle
. Then, to find the section header, we could use the following regexregex
.The
/m
tells Vim to interpret the following regex by themagic
syntax, the/V
tells Vim to interpret the following regex by the almost literal syntax, only the backslashes need escaping. This is achieved by theEscapeString(string)
function.Edit: Apparently the EscapeString function does not even need the '/V' command to work. So it boils down to
The text was updated successfully, but these errors were encountered: