3

I am writing a review and using Latex to create the document. Since I have to go back to many many references I want to take advantage of the folding option with each paragraph I write so I can easily refer to the paragraph title from a fully folded document for a quick idea of what is it each of them about. This is how it looks when it is folded:

+     23 lines: \section{Introduction}------------------------------------------
        \section{Background and literature review}
                \subsection{This is the title of the subsection}
                        \subsubsection{This is the tittle of the subsubsection}
---+   5 lines: > > > \paragraph{This paragraph is about xyz}
---+  19 lines: > > > \paragraph{This paragraph is about abc}  -----------------
---+   5 lines: > > > \paragraph{}----------------------------------------------
---+   5 lines: > > > \paragraph{}----------------------------------------------

This is the unfolded document. As you can see, the first two paragraph has a title while the other two don't have:

\subsubsection{This is the title of the subsubsection}
    \paragraph{This paragraph is about xyz}
    This is the content of the first paragraph
    \paragraph{This paragraph is about abc}
    This is the content of the second paragraph
    \paragraph{}
    This is the content of the third paragraph
    \paragraph{}
    This is the content of the fourth paragraph

When I make the pdf I see this:


This is the title of the subsubsection

This paragraph is about xyz This is the content of the first paragraph

This paragraph is about abc This is the content of the second paragraph

This is the content of the third paragraph

This is the content of the fourth paragraph


As you can see, the first two paragraph (that have a title between the curly brackets) shows the paragraph title before the actual paragraph while the others (with nothing within the curly brackets) show only the paragraphs. When I compile the file to pdf I wan to see only the paragraphs but still having the paragraph titles in the foldings of the .tex file for quick reference. Like this:


This is the title of the subsubsection

This is the content of the first paragraph

This is the content of the second paragraph

This is the content of the third paragraph

This is the content of the fourth paragraph


Is it possible? Thanks.

  • 3
    you mention a "folding option" which I assume (given your tagging) that that is something in vim? anyway i assume if you don't need \paragraph level headings you can do \renewcommand\paragraph[1]{\par} so it always discards its argument. – David Carlisle Apr 19 '18 at 7:57
  • Hi @DavidCarlisle, I have realized that in some parts I may want to use the titles. Is there a way to activate the titles only in specific paragraphs or is just better to use a \subsubsection with the "*" so it appears without the number? – Carlos Riera-Ruiz Apr 19 '18 at 22:28
  • You could create a custom paragraph command like \newcommand{\hidetitlepar}[1]{\par} and use that if you do not want the title to show. Then use the regular \paragraph if you do want the title to show. – Abby Apr 26 '18 at 18:19
1

Latex-suite for Vim provides the %%fake marker for that use case.

From the Latex-Suite manual:

The %%fakesection section is provided as a means for the user to group lines into "fake" sections. In particular, it is useful to fold the introduction of a section that is not part of a subsection:

\section{Latex-Suite}
%%fakesubsection Introduction
A short introduction of the features of Latex-Suite.
\subsection{Installation}
Installation instructions.

Without the %%fakesubsection the introduction would not be folded separately from the section.


For the given example this means:

We use %%fakeparagraph instead of %%fakesubsection to mark each paragraph.

Unfolded

\subsubsection{This is the title of the subsubsection}                              
    %%fakeparagraph This paragraph is about xyz
    This is the content of the first paragraph
    %%fakeparagraph This paragraph is about abc
    This is the content of the second paragraph
    %%fakeparagraph
    This is the content of the third paragraph
    %%fakeparagraph
    This is the content of the fourth paragraph

Folded

\subsubsection{This is the title of the subsubsection}
-+     2 lines: > %paragraph This paragraph is about xyz----------------------------
-+     2 lines: > %paragraph This paragraph is about abc----------------------------
-+     2 lines: > %paragraph--------------------------------------------------------
-+     2 lines: > %paragraph--------------------------------------------------------

Notice how Latex-Suite will remove the fake and just display paragraph and your remarks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.