help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A strange auto typesetting problem when using auctex.


From: Hongyi Zhao
Subject: Re: A strange auto typesetting problem when using auctex.
Date: Mon, 14 Jun 2021 14:12:33 +0800

On Mon, Jun 14, 2021 at 11:45 AM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Ubuntu 20.04, I use the latest git master Emacs version compiled by
> myself. I install and load auctex's git master version with the
> following bootstrap code in `~/.emacs.d/init.el':
>
> ;;Bootstrap auctex via straight
> (straight-use-package
>  `( auctex :type git :host nil :repo
> "https://git.savannah.gnu.org/git/auctex.git";
>     :pre-build ,(pcase system-type
>                 (`berkeley-unix '("gmake"))
>                 (_ '(
>                     ;("bash" "-c" "cd ~/.emacs.d/straight/repos/auctex")
>                     ("./autogen.sh")
>                     ("./configure")
>                     ("make")
>                     ("sudo" "make" "install"))))))
>
> (load "auctex.el" nil t t)
> (load "preview-latex.el" nil t t)
> ;;; auctex config ends here
>
> Then I try to test auctex with the following LaTeX sample file:
>
> %% LaTeX sample file
> \documentclass{paper}
> \usepackage{hyperref}
> \begin{document}
> See
> \href{http://www.fulviofrisone.com/attachments/article/480/Ballentine%20L.%20Quantum%20mechanics%20-%20a%20modern%20development%20(1998)(T)(673s).pdf}{page
> 98}
> \end{document}
> %% LaTeX sample file ends here
>
> When I put the point after the `{page 98}' and hit RET, the LaTeX file
> will be automatically completed into the following:
>
> %% LaTeX sample file
> \documentclass{paper}
> \usepackage{hyperref}
> \begin{document}
> See
> \href{http://www.fulviofrisone.com/attachments/article/480/Ballentine%20L.%20Quantum%20mechanics%20-%20a%20modern%20development%20(1998)(T)(673s).pdf}{page
>   % 98}
>
> \end{document}
> %% LaTeX sample file ends here
>
> As you can see, the auto-completed typesetting result is wrong due to
> the leading `%' before ` 98}'.
>
> Any hints for this problem?

Finally, I found the problem was caused by the '%' character appearing
in the URL, which in its literal form, is a comment character of
LaTeX, so the Emacs/auctex thinks that the newline should be commented
out continuously.

Change the URL line into the following will fix the problem:

\href{http://www.fulviofrisone.com/attachments/article/480/Ballentine\%20L.\%20Quantum\%20mechanics\%20-\%20a\%20modern\%20development\%20(1998)(T)(673s).pdf}{page
98}

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China



reply via email to

[Prev in Thread] Current Thread [Next in Thread]