7

LaTex newbie here. Currently using vim with solarized color scheme to edit .tex documents.

When writing I often jump around to different parts of the document, leaving gaps behind to work on later. In Microsoft Word I would highlight text in yellow to remind myself what needed to be finished. How can I do something similar with my .tex documents? I have seen this question but the answers focus on adding notes or highlighting to the final pdf product. I want something to stand out in the actual tex document I'm working on.

I tried putting comments after the lines, but these didn't stand out very well (almost same color as standard text). This may simply be a color scheme problem.

What is a typical/recommended way to do this?

  • Yes, welcome! Can we assume you're using LaTeX-suite? – Sean Allred May 18 '13 at 3:55
  • The todonotes package is very useful for this. – Peter Grill May 18 '13 at 4:32
  • 3
    print it out and use a highlighter pen. – Nicholas Hamilton May 18 '13 at 4:41
  • 2
    Since % is the comment starter, I will frequently use a string of them %%%%%%%%%% to indicate something to pay attention to. If it is text itself that is left in a state of partial completion, I use @@@ since it is a unique string to search for, and if by chance I typeset it, it looks real ugly in the final printout, thus calling my forgotten attention to it. – Steven B. Segletes May 30 '13 at 16:34
  • 1
    See :he marks in vim. – Aditya Aug 14 '14 at 2:59
6

You could use the soul package. If you put \usepackage{xcolor} and \usepackage{soul} in your preamble, then you can simply use \hl{...} to highlight a piece of text.

Code

\documentclass{article}

\usepackage{xcolor}
\usepackage{soul}

\begin{document}

Nullam accumsan, dui vitae vehicula aliquet, libero ligula congue
turpis, rutrum molestie ante nisl ac mi. Sed sem quam, hendrerit in
fermentum id, elementum quis magna. Proin ac diam lacus, eu egestas
leo. Donec ultricies nulla vel massa semper adipiscing. Etiam
venenatis congue molestie. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos himenaeos. Vivamus ante
risus, gravida non dapibus id, vestibulum nec erat. Cras in lorem vel
nisi pulvinar tristique. Phasellus dignissim, mauris vel convallis
sagittis, tortor magna malesuada justo, nec placerat lorem neque id
mi.

Donec ante enim, imperdiet at eleifend vitae, accumsan ut massa. Donec
laoreet venenatis imperdiet. \hl{Quisque facilisis, arcu nec tempor
varius, felis diam faucibus augue, ac auctor nisi orci ac
justo. Vestibulum et purus orci, sed hendrerit nulla. Fusce et nisi
in justo fringilla malesuada eu ut neque. Integer ac tellus eget
enim aliquam egestas ut sit amet elit. Nulla sagittis tellus ut
velit euismod pulvinar. In dapibus laoreet lectus, sed vulputate
justo laoreet ut. Aenean semper tempor tortor, sed vehicula ligula
pellentesque eget. Sed semper, odio ut ultrices lobortis, nunc nibh
viverra quam, pulvinar tincidunt lacus felis egestas enim. Sed
porttitor eros pretium magna pellentesque sit amet varius nisl
rhoncus.

Suspendisse blandit gravida semper. Fusce luctus, nisl non adipiscing
euismod, ante mi mollis massa, ut vulputate sem nulla non nisi. Mauris
erat est, tincidunt sollicitudin tincidunt in, condimentum ac
turpis. Proin accumsan neque eu mauris accumsan vel} condimentum quam
porta. Nam imperdiet lacinia ligula, vitae luctus orci volutpat
et. Morbi in turpis in lorem venenatis suscipit. Mauris cursus libero
ac sem imperdiet venenatis. Nulla volutpat leo nibh, at ornare
urna. Etiam rhoncus ornare volutpat. Cras pharetra nisl vitae turpis
pulvinar eu suscipit lacus pulvinar. Phasellus ut metus nibh. In at
elit eleifend odio molestie ullamcorper. Integer cursus risus ac quam
viverra tempus.

\end{document}

Result

enter image description here

  • 1
    I don't think this is what the questioner had in mind. He's talking about editing, not final printout. – Steven B. Segletes May 30 '13 at 16:36
  • @StevenB.Segletes Yeah I figured that after writing my answer. Oh well :-). – John Wickerson May 30 '13 at 16:54
  • Been there, done that. I resemble that remark. – Steven B. Segletes May 30 '13 at 16:59
2

When working in Vim, you might want to check out the plugin Txtfmt (The Vim Highlighter). I haven't used it myself yet, but it could suit your purposes.

2

If a text editor makes it easy to search, the way Vim does, then I think comments can work well for this. If you use a consistent keyword it is easy to find. Most Vim colorschemes automatically highlight the strings TODO and XXX.

I write % START HERE and maybe some notes about what I need to do there. Something like this stands out pretty well:

%**********************
% REVISION NEEDED
%***********************

I mapped a key sequence in my .vimrc to create a line like this quickly:

:imap *&* ****************************************

I also defined LaTeX commands to make unfinished business stand out in the PDF draft, as shown in the example. These commands are also easy to search for. You might try this example with different colorschemes in Vim.

\documentclass{article}

\newcommand{\X}{\large\textbf{[FIX]}}
\newcommand{\citX}{{\footnote{\large\textbf{[CITATION NEEDED]}}}}

\begin{document}

This is the beginning. 

% START HERE: add introduction

I am citing a source that is not yet in my database.\citX
This is the end.\X % START better conclusion?

\end{document}

EDIT (2019/05/23): My semantic-markup package provides the commands \XXX and \citXXX with functionality similar to that shown above.

1

You could use the Txtfmt plugin for this. To make it work, you simply need to set the filetype to something like tex.txtfmt (instead of the customary tex).

:help txtfmt-nesting

With Txtfmt highlighting enabled, you could add arbitrary fg/bg colors and formats to your document. Caveat: Txtfmt accomplishes its formatting through the use of invisible tokens inserted in the buffer, but these could be stripped easily with a pre-processing step when you generate your final document.

0

There is no need for extra plugins. Vim should highlight any TODO which is placed in a comment - if syntax highlighting is enabled.

screenshot of highlighted todo

This method also has the advantage to be able to search the latex source for any todos left within your editor.

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.