1

I am working on a document in LaTeX that I am copy/pasting from my original Word working file or an OCR-ed PDF file. The Word file has lots of math blocks, which are also copy/pasted, and the PDF has math symbols as well.

Occasionally upon copying I miss a stray math symbol within a paragraph. For example, the character ρ (rho) may show up in the middle of nowhere and I'll miss it since it looks like a "p." This causes an error while compiling that can be rather time consuming to find.

Is there a way to highlight these sorts of stray symbols? I am using TeXstudio when editing my .tex files. I can't seem to find any option to do so.

For example, in the MWE below, the editor would highlight the "Δ_1 ρ" in the second line of the body. Again, I do not want it highlighted in the output PDF, just highlighted in the editor window so it is easy to find for debugging.

\documentclass[letterpage,12pt]{book}

\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[hyphenation,parindent,lastparline]{impnattypo}
\usepackage[all]{nowidow}
\raggedbottom
\usepackage{verbatim}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[frenchb]{babel}

\begin{document}

This is an inline equation that says $\Delta_1\rho = 123$.  This will compile correctly.

This is an inline equation that says  Δ_1 ρ = 123.  This will cause an error while compiling.

\end{document}

Edit: I am not solely copy/pasting from Word, for which @AboAmmar was kind enough to point me at a Word->TeX conversion Question previously asked. His suggestion will work for the Word case, but not necessarily for other cases where this error could occur.

  • ,@grfrazee You are doing it the hard way, please have a look at this question: tex.stackexchange.com/questions/46015/… – AboAmmar Jul 20 '15 at 22:34
  • It looks like the link you provided will work, but I still think this is a valid question in general. There will be cases where I copy/paste from, say, a PDF and the same issue occurs. – grfrazee Jul 20 '15 at 22:53
  • Would hi-lighting all instances of selected characters such Δ and ρ throughout the document, and not just the ones that occur in text mode, work for you? – Mico Jul 22 '15 at 13:44
  • If it is highlighting the non-math characters (i.e., highlight Δ and ρ but not \delta or \rho), then yes. – grfrazee Jul 22 '15 at 13:45

Your Answer

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

Browse other questions tagged or ask your own question.