# Highlight footnote in the original tex file?

I am writing academic papers with lots of footnotes. The writing process is not ideal, since when I am writing the original .tex file, all footnotes are embedded in the main text. Often, a long paragraph in the original .tex file is a mixture of main text and footnotes. Example (just an example...):

The film Star Trek is interesting.\footnote{See Tom (2002) for a similar view.} But some have argued that it is not well directed.\footnote{See Jim (2001) and Frank (2002).} I've explained elsewhere that this is not right.\footnote{Author (forthcoming).} In this paper, i will blah blah blah.\footnote{dadada.}


This makes the writing and revising process not ideal. It would be nice if there is a tool or app which can highlight my footnotes on the original .tex file (or just change font colors, or anything like that). Anything like this? Thanks.

• do you mean in your editor or in your .pdf? – Runar Sep 5 '16 at 18:56
• My editor. I am using texstudio and found a discussion about this concern 4 years ago. but there seems no solution. If other editor has this function I think i am glad to switch. – H.Hong Sep 5 '16 at 19:03
• You should make your question a bit more clear in that case. – Runar Sep 5 '16 at 19:06
• To make commands like these easier to spot in my editir, I put them on a line by their selves. The output will be the same, and it will be easy to see. Many editors has colors for macros. – Runar Sep 5 '16 at 19:59
• I think this can be done. See How can I set a dark theme in TeXstudio? (duplicate?). – Alan Munn Sep 5 '16 at 20:06

Rather than using syntax highlighting, why don't you improve readability by moving your footnotes out of the main paragraph?

With the sepfootnotes package you can put (longer) footnotes outside paragraphs.

Here are a couple of examples:

# Example 1: footnotes separate from paragraphs

\documentclass{article}
\usepackage{sepfootnotes}
\begin{document}

\sepfootnotecontent {a} {See Tom (2002) for a similar view.}
\sepfootnotecontent {b} {See Jim (2001) and Frank (2002).}
\sepfootnotecontent {c} {Author (forthcoming).}

The film Star Trek is interesting.\sepfootnote{a}
But some have argued that it is not well directed.\sepfootnote{b}
I've explained elsewhere that this is not right.\sepfootnote{c}

\end{document}


Notice that you can use \sepfootnote for long notes, and keep using standard \footnote for short notes (like your "dadada" note) if you want to.

# Example 2: footnotes in a separate file

Better still, here is how to move your footnotes to a separate file using \input.

## doc.tex

\documentclass{article}
\usepackage{sepfootnotes}
\input{notes}
\begin{document}

The film Star Trek is interesting.\sepfootnote{a}
But some have argued that it is not well directed.\sepfootnote{b}
I've explained elsewhere that this is not right.\sepfootnote{c}

\end{document}


## notes.tex

\sepfootnotecontent {a} {See Tom (2002) for a similar view.}
\sepfootnotecontent {b} {See Jim (2001) and Frank (2002).}
\sepfootnotecontent {c} {Author (forthcoming).}


# Example 3: shorter footnote commands

And you can make your text even more clean if you define shorter footnote commands by using \newfootnotes, which is also provided by the sepfootnotes package.

For example, in order to typeset footnotes using \anote and \anotecontent, instead of the default \sepfootnote and \sepfootnotecontent, you just need to declare \newfootnotes{a} in the preamble. Like this:

\documentclass{article}
\usepackage{sepfootnotes}
\newfootnotes{a}
\input{notes}
\begin{document}

The film Star Trek is interesting.\anote{a}
But some have argued that it is not well directed.\anote{b}
I've explained elsewhere that this is not right.\anote{c}

\end{document}


## notes.tex

\anotecontent {a} {See Tom (2002) for a similar view.}
\anotecontent {b} {See Jim (2001) and Frank (2002).}
\anotecontent {c} {Author (forthcoming).}

• While this is very neat, the problem is that you create for yourself the same problem that the reader has when encountering a footnote or reference: you have to jump somewhere else to read the content, then you can't remember where you were! – LondonRob Feb 14 '18 at 17:11
• You might put your footnote content definition right before the paragraph where the footnote mark appears, and think of footnotes as "headnotes" for editing purposes. – n.r. Mar 28 '18 at 9:57

In TeXstudio, you can modify the Language Definition.

Note: We expose the language specification to you as end-user to give you more flexibility in adapting TeXstudio to your needs. But you should take it as is, because we don't have the capacity to give support here.

2. Create a folder languages in your settings directory and place the file therein.
3. In the simplest case, just treat \footnote like \todo: Add the line below to the existing <context id="comment/todocmd" ...>

<context id="comment/todocmd" format="commentTodo">
...
<start parenthesis="todo:open" prenthesisweight="12">\\footnote\{</start>
...
</context>


Restart TeXstudio. The result should look like this:

Of course, you may copy the comment/todocmd context and create your own context if you need more control.

• I'm trying to use it with \note command and ii highlight the entire text after the first "\xnote" (seems like it doesn't recognize the end of the command). Moreover I would like to use it in combination with my color scheme, because if I use tex.qnfa it replaces my personal .txs profile with standard colors. – Alessio Feb 8 '17 at 10:03
• I am in the same situation as the original questioner. The above suggestion is exactly what I want to do, but unfortunately the instructions for hacking tex.qnfa don't work. I'm not able to understand and work with qxs programming, especially because of the lack of examples to copy. I simply want my \footnote text to have a slightly different background colour. Like light grey, or something. That's all. It's not too much to ask, is it? Pretty please? – Dominik Mar 19 '18 at 15:26

Well, with a little pretty printing of your TeX code I think you can better see where footnotes starts and ends. Then there is no tool needed I think ...

See the following code example (I used a longer text in one of your footnotes):

\documentclass{article}
\begin{document}
The film Star Trek is interesting.\footnote{See
Tom (2002) for a similar view. Dummy text for a longer footnote to
show the line breaks I do in the \TeX{} code.}
But some have argued that it is not well directed.\footnote{See
Jim (2001) and Frank (2002).}
I've explained elsewhere that this is not right.\footnote{Author
(forthcoming).}
In this paper, i will blah blah blah.%

In the case you have only one word in the footnote (your last given example) I write an % after the dot of the sentence (to avoid that there could be a inserted blank) and write \footnote{dadada.} in the next line, followed by a line break.