-
Notifications
You must be signed in to change notification settings - Fork 37
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
Latex comments broken by wrap #31
Comments
I can confirm this annoying behavior and would also love to see this corrected. Maybe it is related to my issue / workaround #27. |
Also the following can happen:
becomes
(and is thus commented out...) I actually did exactly this to a scientific paper without realising.. Thankfully a co-author noticed before we submitted... Also another example that can be a major major hassle to fix if you don't realise until later:
becomes
|
@rosshemsley This is another problem that is fixed in my workaround #27, but the pull requiest doesn't seems to be interresting for the maintainer. As you describe it, I also think that this can lead to serious problems when typesetting latex. |
I'll take a look at it soon. I don't use LaTeX, so it hasn't been a priority for me. I think it will need to distinguish the boundaries between comments and non-comments. Right now, it assumes comments are on the entire line, and also doesn't even look for comments if you initiate the command outside of a comment scope. |
If you do find yourself looking to support LaTeX officially, maybe I can give a couple In LaTeX, whitespace has meaning, so if you write:
you get different output if you write:
Which means the comments often end up being next to the text, and so when wrapping a block Also, I spotted that there was a rule for hyphens. In LaTex, the default should probably be to Finally: equations and commands. It would be great to have a couple of rules for equations
->
Just some thoughts. Anyway, when I'm more free I might be interested in helping out if I get the time (I use this package Ross |
@rosshemsley Nice ideas! The block-wise comment distinguishing already works for me with the workaround, but I guess a better latex parsing would also make other applications possible. For the hyphenation you can already add Regarding equations, I think we shouldn't change something on I would also like to volunteer for testing possible LaTeX enhancements. |
I pushed a change that should help with some of the more fatal problems. Let me know if that helps. There are still quite a few situations it may have trouble with. If there is a comment at the end of a line, for the most part it will ignore it. I was playing around with AUCTeX for emacs, which does a pretty good job of wrapping/formatting latex, and that's what it does. Having language-specific parsing/recognition would be nice. That could lead to a wide range of beautifying possibilities. |
@ehuss That changes work good for most of my usual use cases. However, in this case
is wrongly modified to
|
Where on the line was the cursor when you executed the wrap command? If it was inside the comment, then I am aware of that. That particular case is somewhat more difficult to address, partially because there are different ways to approach it. AUCTeX which I mentioned before will wrap it justified like: We refer the reader to the proof in Lemma~\ref{lem:FLT} % Here is some text
% that I have decided
% to remove.
the proof given is particularly elegant because of reasons X,Y,Z... Alternatively it could wrap it left-flushed like: We refer the reader to the proof in Lemma~\ref{lem:FLT} % Here is some text
% that I have decided to remove.
the proof given is particularly elegant because of reasons X,Y,Z... Neither approach seems particularly great to me. I guess that could be an option? If you didn't execute inside the comment, then make sure you have version 2014.05.12.07.17.37. I tested your text, and trying to wrap anywhere outside the comment should leave the comment untouched. |
Indeed, I executed it inside of the comment. Executing the script in the regular text works fine. Either option is fine for me. Could it be possible to bring all trailing comments into individual directly attached lines, like
|
This line
gets wrapped to this
and now the word "comment" is no longer a comment.
Ideally, the wrap would result in
The text was updated successfully, but these errors were encountered: