# LaTeX editor with in-line folding

Quick question. Are there LaTeX editors that can do in-line folding? That is, that can fold a demarcated piece of code or text without having that piece of code or text on its own line or group of lines?

I ask this because I often write sentences with multiple footnotes. Having to fold these footnotes on their own lines (as seems to be necessary in TeXstudio and Emacs; please correct me if I'm wrong) results in single sentences being broken up into many different lines in the editor window, with folded lines in between, and sometimes only one or two words on a line. This problem does not get in the way of producing a pretty pdf, but it makes for annoying editing.

LyX can do this (that is, it can fold footnotes and just show a little "Note" tab in-line), but for the kind of documents I work on, LyX has a few downsides. I am working on Windows 7, but considering switching to or dual-booting with Ubuntu. The ability to do this could make a difference in getting me finally off my addiction to Word.

Here is an example of the kind of footnotes I would like to be able to fold.

\documentclass{article}
\begin{document}
Here I am just typing along.\footnote{This is a footnote I can't fold up, because it isn't on its own line.} I can
fold up this footnote at the end of a sentence.\footnote
{
I can fold this footnote up, but it breaks my paragraph.}
But I would really like to be able to fold\footnote
{
I can fold this footnote up, but it breaks my sentence in half anyway.}
up footnotes in-line, so that my sentences don't break awkwardly in the middle.
\end{document}

• As a workaround, you could plae the footnotes on their own lines, hiding new lines with a comment sign. – Johannes_B Sep 23 '14 at 8:34
• Johannes_B, could you elaborate on what you mean by this? I'm not sure how the result would be different from the above example, in which I can hide both the second and the third footnotes (beginning with "I can fold this footnote up") into lines that only display the {. But the sentences are still broken in the middle. How would a comment character help? – LukeB Sep 23 '14 at 8:45
• end of a sentence.%<C-r>\footnote{footnote text over many lines Tested with TeXstudio. I don't use emacs, nor winedt. My preferred editor is vim. – Johannes_B Sep 23 '14 at 8:50
• Johannes_B, thanks for your help on this. I think I'm still missing something though, probably through my own lack of savvy with these things. When I copy your example code, I can't fold it up, and what is more, the footnote is now commented out, so it won't compile into the pdf. Should I add a line-break after the %? What is <C-r> doing here (isn't it by default the replace function in TeXstudio)? Finally, since you prefer vim, does it have the option to in-line fold code in the editor? Thanks again. – LukeB Sep 23 '14 at 9:23
• <C-r> stands for a linebreak. Put it after the percent sign. That prevents LaTeX seeing a space there. Now the \footnote is on it's own line and folds. Not the cleanest solution tough. – Johannes_B Sep 23 '14 at 12:16