Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm reading a lot of papers, and writing notes on them as I go. I want to make a single document containing one \section for every proceedings-year, with a \subsection for every paper. (I'm using biblatex).

An example:

\section{Proceedings-Year}

\subsection{\citetitle*{foobarbaz}}
\subsubsection{Topics Addressed}
\begin{itemize}
\item Foo
\item Bar
\item FooBar
\end{itemize}

\subsubsection{Paper Quality}
\textbf{Medium}: This paper is well-written, but foo bar baz blah. 

\subsubsection{Notes}
Some notes on the paper. It might be interesting, or not, or whatever. 

\subsubsection{Citation}
\begin{quote}
\fullcite{foobarbaz}
\end{quote}
\hrulefill

I'm happy with the layout, but I don't like copy-pasting this layout every time I want to add another section. (Plus, fiddling with the layout gets very tedious quickly).

What's the best way to automatically insert a copy of this section template? Approaches I can think of:

  • Write a macro. However, I have at least 7 bits of text I'd need to pass in (in the given example), more if a paper covers more than 3 topics. (I've never written a macro, and looking at examples I'm not sure this is the best approach).
  • Insert automatically (at the editor level). That's fairly easy to do with a vim macro, but means if I edit the layout of the section I'll have to edit lots of times.
  • Create a new document class. It seems like this could work, but I have no experience doing so, and I think perhaps it's overkill?

I'm not asking for a full solution (although if one is given, I wouldn't complain), but rather the right (easiest? Quickest?) direction to go in to solve this. Any thoughts are appreciated.

share|improve this question
    
Use emacs: then you can either use something like yasnippet if you want to automatically insert a code template and take 'LaTeX'-style notes, or you can use org-mode to take notes, which can then be exported to a large number of different formats. (I prefer org-mode for things like note-taking.) –  jon Mar 28 '13 at 22:21

2 Answers 2

up vote 2 down vote accepted

Have a look at the UltiSnips plugin. It enables you to create snippets that are triggered by a hotkey and expand to something. There are already plenty of snippets defined, just have a look at the directory UltiSnips file tex.snippets, which work out-of-the-box. And it's easy to create new ones. Here is an example of an existing snippet:

snippet enum "Enumerate" b
\begin{enumerate}
        \item $0
\end{enumerate}
endsnippet

This one is triggered by typing enum at the beginning of a line followed by pressing tab. You can define several jump positions with $0, $1, etc. which can be addressed by hitting tab once more.

There are other plugins which serve a similar purpose. The advantage of a general solution is that you can use it for everything, not only for TeX.

share|improve this answer

Assume that you use texmaker. It offers you unlimited number of snippets. Look out for Unlimited number of snippets at the bottom of the page -- texmaker and a demo video at youtube or refer to texmaker manual section 4.4.

enter image description here

  1. Click on the user symbol encircled with red in the above picture.
  2. right click on the area under parenth in the picture to get Add tag etc. Choose Add tag
  3. The Edit User Tags window will open. Write in your snippet as shown in the picture. The content to be filled should be indicated by @. For your case you may use:

Item -->

sect

LaTeX Content -->

\section{Proceedings-Year}

\subsection{\citetitle*{foobarbaz}}
\subsubsection{Topics Addressed}
\begin{itemize}
\item @
\item @
\item @
\end{itemize}

\subsubsection{Paper Quality}
\textbf{Medium}: @

\subsubsection{Notes}
@

\subsubsection{Citation}
\begin{quote}
\fullcite{foobarbaz}
\end{quote}
\hrulefill

and Keyboard Trigger as

 sect

Press OK to get an item sect as shown below. Clicking this will produce the snippet with which has to be replaced by your text. You can move to the next by pressing Tab and in reverse by Shift + Tab .

enter image description here

You can also activate this by typing :sect and pressing .

share|improve this answer
    
The OP clearly states that he uses vim. Why do you assume he uses texmaker? –  Marco Mar 28 '13 at 16:50
    
@Marco Because I am a Physicist ;-) –  Harish Kumar Mar 28 '13 at 22:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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