Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 938845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:42:05+00:00 2026-05-15T21:42:05+00:00

AucTeX on emacs is pretty amazing tool, but when I write one single ‘$’,

  • 0

AucTeX on emacs is pretty amazing tool, but when I write one single ‘$’, all the coloring is broken.

Normally one ‘$’ is accompanied by another ‘$’ to express math equations, but for source listing single ‘$’ is frequently used.

\begin{Verbatim}
(let ((buffer (url-retrieve-synchronously
...
    (re-search-forward "^$" nil 'move) <-- It breaks the coloring 
...
\end{Verbatim}

The easy solution is as follows to match the ‘$’.

(re-search-forward "^$" nil 'move) ;; $

Is there any option in AucTeX to prevent this single ‘$’ problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:42:05+00:00Added an answer on May 15, 2026 at 9:42 pm

    AUCTeX knows that $ is not special in verbatim environments, but you have to tell it that Verbatim is a verbatim environment by arranging for it to appear in LaTeX-verbatim-environments-local.

    If AUCTeX is installed optimally, it already knows, because AUCTeX loads a style hook for each file you load through \usepackage and friends. You may need to tell it to parse your header file with C-c C-n (TeX-normal-mode).

    If that’s not enough, it means Verbatim was defined in a style file for which AUCTeX doesn’t have enough information. You can tell AUCTeX to parse some or all the style files you have installed; see the “Automatic” chapter in the AUCTeX manual.

    Sometimes AUCTeX doesn’t manage to parse the style file; then you can do this part by hand. The code below assumes that you’re getting the Verbatim environment from the fancyvrb package; adapt the name otherwise. Create a file called fancyvrb.el in one of the directories mentioned in TeX-style-path with the following contents (there may be other things worth putting there, I’ve just adapted alltt.el):

    (TeX-add-style-hook
     "fancyvrb"
     (lambda ()
       (LaTeX-add-environments "BVerbatim" "LVerbatim" "SaveVerbatim" "Verbatim")
       (make-local-variable 'LaTeX-indent-environment-list)
       (add-to-list 'LaTeX-indent-environment-list '("BVerbatim" current-indentation))
       (add-to-list 'LaTeX-indent-environment-list '("LVerbatim" current-indentation))
       (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim" current-indentation))
       (add-to-list 'LaTeX-indent-environment-list '("Verbatim" current-indentation))
       (make-local-variable 'LaTeX-verbatim-regexp)
       (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|\\([BL]?\\|Save\\)Verbatim"))
       (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim")
       (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim")
       (add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
       (add-to-list 'LaTeX-verbatim-environments-local "Verbatim")
       (when (and (featurep 'font-latex)
                  (eq TeX-install-font-lock 'font-latex-setup))
         (font-latex-set-syntactic-keywords)
         (setq font-lock-set-defaults nil)
         (font-lock-set-defaults))))
    

    (I thought you could also do it manually through file variables, but this turns out not to work, because the font-lock settings are built before the file local variables are initialized, and I don’t see a workaround.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.