* Unicode characters for transcribing to pdf
@ 2022-08-31 14:32 wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-31 15:28 ` Eric S Fraga
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-31 14:32 UTC (permalink / raw)
To: Help Gnu Emacs
Have been writing a tex document on emacs utilising UTF-8.
Then using pdflatex to make the pdf. But pdflatex is reporting that unicode character ħ (U+0127) is not set up for use with LaTeX.
What Gnu program could I use that is UTF-8 aware? I know this has nothing to do with emacs,
but I do not know any latex gnu program that can make pdf from latex and to which I can send
this description to an appropriate mailing list.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 14:32 Unicode characters for transcribing to pdf wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-31 15:28 ` Eric S Fraga
2022-08-31 16:04 ` uzibalqa
2022-08-31 17:27 ` tomas
2022-08-31 21:37 ` Joost Kremers
2 siblings, 1 reply; 23+ messages in thread
From: Eric S Fraga @ 2022-08-31 15:28 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 31 Aug 2022 at 16:32, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
> Then using pdflatex to make the pdf. But pdflatex is reporting that
> unicode character ħ (U+0127) is not set up for use with LaTeX.
>
> What Gnu program could I use that is UTF-8 aware?
Instead of using another program, you can tell LaTeX how to generate the
character you want when it is encountered. Something along these lines
should work:
\usepackage{newunicodechar}
\newunicodechar{α}{\ensuremath{\alpha}}
\newunicodechar{±}{\ensuremath{\pm}}
based on the newunicodechar package and assuming you can build up the
character glyph you want from basic LaTeX commands, including maths
mode.
HTH,
eric
--
Eric S Fraga via gnus (Emacs 29.0.50 2022-08-16) on Debian 11.4
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 15:28 ` Eric S Fraga
@ 2022-08-31 16:04 ` uzibalqa
2022-08-31 16:31 ` Eric S Fraga
0 siblings, 1 reply; 23+ messages in thread
From: uzibalqa @ 2022-08-31 16:04 UTC (permalink / raw)
To: Eric S Fraga; +Cc: help-gnu-emacs
------- Original Message -------
On Wednesday, August 31st, 2022 at 3:28 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Wednesday, 31 Aug 2022 at 16:32, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
>
> > Then using pdflatex to make the pdf. But pdflatex is reporting that
> > unicode character ħ (U+0127) is not set up for use with LaTeX.
> >
> > What Gnu program could I use that is UTF-8 aware?
>
>
> Instead of using another program, you can tell LaTeX how to generate the
> character you want when it is encountered. Something along these lines
> should work:
>
> \usepackage{newunicodechar}
> \newunicodechar{α}{\ensuremath{\alpha}}
> \newunicodechar{±}{\ensuremath{\pm}}
>
> based on the newunicodechar package and assuming you can build up the
> character glyph you want from basic LaTeX commands, including maths
> mode.
>
> HTH,
> eric
Perhaps it would be easier to use org-mode if it allows UTF-8 characters, which I can then convert
to pdf.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 16:04 ` uzibalqa
@ 2022-08-31 16:31 ` Eric S Fraga
2022-08-31 16:49 ` uzibalqa
0 siblings, 1 reply; 23+ messages in thread
From: Eric S Fraga @ 2022-08-31 16:31 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 31 Aug 2022 at 16:04, uzibalqa wrote:
> Perhaps it would be easier to use org-mode if it allows UTF-8
> characters, which I can then convert to pdf.
But org uses LaTeX as the intermediate step in creating a PDF.
In fact, those lines above, prefixed with #+latex_header:, is what I
have in my org file that uses various greek and maths characters in
the text.
--
Eric S Fraga via gnus (Emacs 29.0.50 2022-08-16) on Debian 11.4
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 16:31 ` Eric S Fraga
@ 2022-08-31 16:49 ` uzibalqa
0 siblings, 0 replies; 23+ messages in thread
From: uzibalqa @ 2022-08-31 16:49 UTC (permalink / raw)
To: Eric S Fraga; +Cc: help-gnu-emacs
------- Original Message -------
On Wednesday, August 31st, 2022 at 4:31 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Wednesday, 31 Aug 2022 at 16:04, uzibalqa wrote:
>
> > Perhaps it would be easier to use org-mode if it allows UTF-8
> > characters, which I can then convert to pdf.
>
>
> But org uses LaTeX as the intermediate step in creating a PDF.
>
> In fact, those lines above, prefixed with #+latex_header:, is what I
> have in my org file that uses various greek and maths characters in
> the text.
> --
> Eric S Fraga via gnus (Emacs 29.0.50 2022-08-16) on Debian 11.4
I have seen that xelatex handles UTF-8 characters quite well compared with pdflatex.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 14:32 Unicode characters for transcribing to pdf wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-31 15:28 ` Eric S Fraga
@ 2022-08-31 17:27 ` tomas
2022-08-31 21:37 ` Joost Kremers
2 siblings, 0 replies; 23+ messages in thread
From: tomas @ 2022-08-31 17:27 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
On Wed, Aug 31, 2022 at 04:32:29PM +0200, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
>
> Have been writing a tex document on emacs utilising UTF-8.
>
> Then using pdflatex to make the pdf. But pdflatex is reporting that unicode character ħ (U+0127) is not set up for use with LaTeX.
There was a long discussion not long ago in emacs-orgmode about
which flavour of (La)TeX to use for different cases. For UTF-8
the conclusion was, AFAIU, Lua(La)Tex.
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 14:32 Unicode characters for transcribing to pdf wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-31 15:28 ` Eric S Fraga
2022-08-31 17:27 ` tomas
@ 2022-08-31 21:37 ` Joost Kremers
2022-09-01 4:18 ` uzibalqa
2022-09-01 13:05 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 2 replies; 23+ messages in thread
From: Joost Kremers @ 2022-08-31 21:37 UTC (permalink / raw)
To: wilnerthomas; +Cc: help-gnu-emacs
On Wed, Aug 31 2022, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
> Have been writing a tex document on emacs utilising UTF-8.
>
> Then using pdflatex to make the pdf. But pdflatex is reporting that unicode
> character ħ (U+0127) is not set up for use with LaTeX.
>
> What Gnu program could I use that is UTF-8 aware? I know this has nothing to do
> with emacs,
> but I do not know any latex gnu program that can make pdf from latex and to
> which I can send
> this description to an appropriate mailing list.
Use xelatex or lualatex if you have utf-8 encoded input files. They are two
alternative TeX engines that are normally included in every TeX distribution.
If you use AUCTeX (which you should), set the TeX engine to use with the
variable `TeX-engine`.
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 21:37 ` Joost Kremers
@ 2022-09-01 4:18 ` uzibalqa
2022-09-01 9:12 ` Alessandro Bertulli
[not found] ` <87edwve99q.fsf@gmail.com-NAsW-xw----2>
2022-09-01 13:05 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 2 replies; 23+ messages in thread
From: uzibalqa @ 2022-09-01 4:18 UTC (permalink / raw)
To: Joost Kremers; +Cc: wilnerthomas, help-gnu-emacs
------- Original Message -------
On Wednesday, August 31st, 2022 at 9:37 PM, Joost Kremers <joostkremers@fastmail.fm> wrote:
> On Wed, Aug 31 2022, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
>
> > Have been writing a tex document on emacs utilising UTF-8.
> >
> > Then using pdflatex to make the pdf. But pdflatex is reporting that unicode
> > character ħ (U+0127) is not set up for use with LaTeX.
> >
> > What Gnu program could I use that is UTF-8 aware? I know this has nothing to do
> > with emacs,
> > but I do not know any latex gnu program that can make pdf from latex and to
> > which I can send
> > this description to an appropriate mailing list.
>
>
> Use xelatex or lualatex if you have utf-8 encoded input files. They are two
> alternative TeX engines that are normally included in every TeX distribution.
>
> If you use AUCTeX (which you should), set the TeX engine to use with the
> variable `TeX-engine`.
I did not have AUCTeX installed. Now I have installed it from my package manager.
What do I have to de from the emacs front? Will I need some settings to allow use
of some auctex functionality?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-01 4:18 ` uzibalqa
@ 2022-09-01 9:12 ` Alessandro Bertulli
2022-09-01 12:04 ` Arash Esbati
[not found] ` <87edwve99q.fsf@gmail.com-NAsW-xw----2>
1 sibling, 1 reply; 23+ messages in thread
From: Alessandro Bertulli @ 2022-09-01 9:12 UTC (permalink / raw)
To: uzibalqa; +Cc: Joost Kremers, wilnerthomas, help-gnu-emacs
uzibalqa <uzibalqa@proton.me> writes:
> ------- Original Message -------
> On Wednesday, August 31st, 2022 at 9:37 PM, Joost Kremers <joostkremers@fastmail.fm> wrote:
>
>
>> On Wed, Aug 31 2022, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
>>
>> If you use AUCTeX (which you should), set the TeX engine to use with the
>> variable `TeX-engine`.
>
> I did not have AUCTeX installed. Now I have installed it from my package manager.
> What do I have to de from the emacs front? Will I need some settings to allow use
> of some auctex functionality?
Yap, the manual is pretty comprehensive. For example,
https://www.gnu.org/software/auctex/manual/auctex/Installation.html#Installation
here you can find the installation instruction.
However, I found that I also needed to place
(require 'latex)
(require 'tex-mode)
in my init file. Then, as Joost advised, set the variable `TeX-engine'.
P.S., you may also want to explore RefTeX, it's a super package to
manage citations, crosslinks and reference when writing LaTeX.
Alessandro
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
[not found] ` <87edwve99q.fsf@gmail.com-NAsW-xw----2>
@ 2022-09-01 11:35 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-09-03 10:54 ` Alessandro Bertulli
0 siblings, 1 reply; 23+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-09-01 11:35 UTC (permalink / raw)
To: Alessandro Bertulli; +Cc: uzibalqa, Joost Kremers, help-gnu-emacs
--
Sent with Tutanota, enjoy secure & ad-free emails.
Sep 1, 2022, 09:12 by alessandro.bertulli96@gmail.com:
>
> uzibalqa <uzibalqa@proton.me> writes:
>
>> ------- Original Message -------
>> On Wednesday, August 31st, 2022 at 9:37 PM, Joost Kremers <joostkremers@fastmail.fm> wrote:
>>
>>
>>> On Wed, Aug 31 2022, wilnerthomas--- via Users list for the GNU Emacs text editor wrote:
>>>
>>> If you use AUCTeX (which you should), set the TeX engine to use with the
>>> variable `TeX-engine`.
>>>
>>
>> I did not have AUCTeX installed. Now I have installed it from my package manager.
>> What do I have to de from the emacs front? Will I need some settings to allow use
>> of some auctex functionality?
>>
>
> Yap, the manual is pretty comprehensive. For example,
> https://www.gnu.org/software/auctex/manual/auctex/Installation.html#Installation
> here you can find the installation instruction.
>
Why does it say "Package auctex is available obsolete."
> However, I found that I also needed to place
>
> (require 'latex)
> (require 'tex-mode)
>
> in my init file. Then, as Joost advised, set the variable `TeX-engine'.
>
> P.S., you may also want to explore RefTeX, it's a super package to
> manage citations, crosslinks and reference when writing LaTeX.
>
> Alessandro
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-01 9:12 ` Alessandro Bertulli
@ 2022-09-01 12:04 ` Arash Esbati
2022-09-03 10:58 ` Alessandro Bertulli
0 siblings, 1 reply; 23+ messages in thread
From: Arash Esbati @ 2022-09-01 12:04 UTC (permalink / raw)
To: Alessandro Bertulli; +Cc: uzibalqa, Joost Kremers, wilnerthomas, help-gnu-emacs
Alessandro Bertulli <alessandro.bertulli96@gmail.com> writes:
> Yap, the manual is pretty comprehensive. For example,
> https://www.gnu.org/software/auctex/manual/auctex/Installation.html#Installation
> here you can find the installation instruction.
>
> However, I found that I also needed to place
>
> (require 'latex)
> (require 'tex-mode)
>
> in my init file.
Can you please elaborate why it was necessary to add the lines above to
your init file in order to make AUCTeX run? How did you install AUCTeX?
> P.S., you may also want to explore RefTeX, it's a super package to
> manage citations, crosslinks and reference when writing LaTeX.
+1
Best, Arash
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-08-31 21:37 ` Joost Kremers
2022-09-01 4:18 ` uzibalqa
@ 2022-09-01 13:05 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 23+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-09-01 13:05 UTC (permalink / raw)
To: help-gnu-emacs
> Use xelatex or lualatex if you have utf-8 encoded input files. They are two
> alternative TeX engines that are normally included in every TeX distribution.
>
> If you use AUCTeX (which you should), set the TeX engine to use with the
> variable `TeX-engine`.
In the built-in latex-mode, when you `C-c C-c` you can type `xe TAB` or
`lua TAB` to select the engine you want. You should need to do
that the first time only and it should be automatically selected the next
time around.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-01 11:35 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-09-03 10:54 ` Alessandro Bertulli
0 siblings, 0 replies; 23+ messages in thread
From: Alessandro Bertulli @ 2022-09-03 10:54 UTC (permalink / raw)
To: wilnerthomas; +Cc: Alessandro Bertulli, uzibalqa, Joost Kremers, help-gnu-emacs
wilnerthomas@tutanota.com writes:
> Why does it say "Package auctex is available obsolete."
That's very strange. Did you say you installed AUCTeX using package.el
(the Emacs default package manager)? Can you please try:
- M-x list-packages
- U (to mark for update)
- x, then y (to actually update)
- g (to refresh the contents)
Then see if the message still pops up.
Moreover, have you configured any other package archives? Have you only
ELPA? Or did you add, for instance, MELPA, or Marmelade?
Alessandro
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-01 12:04 ` Arash Esbati
@ 2022-09-03 10:58 ` Alessandro Bertulli
2022-09-03 18:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 23+ messages in thread
From: Alessandro Bertulli @ 2022-09-03 10:58 UTC (permalink / raw)
To: Arash Esbati
Cc: Alessandro Bertulli, uzibalqa, Joost Kremers, wilnerthomas,
help-gnu-emacs
Arash Esbati <arash@gnu.org> writes:
> Alessandro Bertulli <alessandro.bertulli96@gmail.com> writes:
>
>> However, I found that I also needed to place
>>
>> (require 'latex)
>> (require 'tex-mode)
>>
>> in my init file.
>
> Can you please elaborate why it was necessary to add the lines above to
> your init file in order to make AUCTeX run? How did you install AUCTeX?
I installed it using package.el. Then for some reason I had problems
configuring keybindings in LaTeX-mode-map: somehow the variable seemed
to not be defined. I manually searched for it in the package (M-x
grep-find iirc), then required the relevant files.
I would say it's a bug, but notice that I am currently on Emacs 29.0.50,
and I don't use use-package. May these be the causes? Do you have the
same problems? Is LaTeX-mode-map defined for you (e.g., in C-h v)?
Alessandro
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-03 10:58 ` Alessandro Bertulli
@ 2022-09-03 18:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-04 6:32 ` Emanuel Berg
2022-09-04 22:16 ` Alessandro Bertulli
0 siblings, 2 replies; 23+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-09-03 18:24 UTC (permalink / raw)
To: help-gnu-emacs
> I installed it using package.el. Then for some reason I had problems
> configuring keybindings in LaTeX-mode-map: somehow the variable seemed
> to not be defined. I manually searched for it in the package (M-x
> grep-find iirc), then required the relevant files.
`LaTeX-mode-map`, like most package variables, is only defined once
its package is actually loaded, which is done lazily in response to the
use of the package (e.g. opening a LaTeX file).
So it's normal that `LaTeX-mode-map` is not defined when your init file
is loaded. This is on purpose to try and speed up Emacs's startup.
You can use things like:
(with-eval-after-load 'latex
(define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
(define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
or
(defun my-latex-setup ()
(define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
(define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
(add-hook 'LaTeX-mode-hook #'my-latex-setup)
in order to delay the customization to after the variable is defined.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-03 18:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-09-04 6:32 ` Emanuel Berg
2022-09-05 11:44 ` Akib Azmain Turja
2022-09-04 22:16 ` Alessandro Bertulli
1 sibling, 1 reply; 23+ messages in thread
From: Emanuel Berg @ 2022-09-04 6:32 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>> I installed it using package.el. Then for some reason I had
>> problems configuring keybindings in LaTeX-mode-map: somehow
>> the variable seemed to not be defined. I manually searched
>> for it in the package (M-x grep-find iirc), then required
>> the relevant files.
>
> `LaTeX-mode-map`, like most package variables, is only
> defined once its package is actually loaded, which is done
> lazily in response to the use of the package (e.g.
> opening a LaTeX file).
https://en.wikipedia.org/wiki/Lazy_loading
> So it's normal that `LaTeX-mode-map` is not defined when
> your init file is loaded. This is on purpose to try and
> speed up Emacs's startup.
Does it really make it that slow? Must be something from
Emacs' past, maybe ...
And besides you shouldn't restart Emacs all the time either?
With this
(require 'tex-mode)
(define-key latex-mode-map "\C-c\C-c" #'compile)
starting Emacs is almost instant.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-03 18:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-04 6:32 ` Emanuel Berg
@ 2022-09-04 22:16 ` Alessandro Bertulli
2022-09-05 4:39 ` tomas
` (2 more replies)
1 sibling, 3 replies; 23+ messages in thread
From: Alessandro Bertulli @ 2022-09-04 22:16 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
> `LaTeX-mode-map`, like most package variables, is only defined once
> its package is actually loaded, which is done lazily in response to the
> use of the package (e.g. opening a LaTeX file).
>
> So it's normal that `LaTeX-mode-map` is not defined when your init file
> is loaded. This is on purpose to try and speed up Emacs's startup.
>
> You can use things like:
>
> (with-eval-after-load 'latex
> (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
> (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
You honestly opened a world to me. I have long wondered the difference
between require and with-eval-after-load (of course I could have read
the docs, but I never found time). :-)
> or
>
> (defun my-latex-setup ()
> (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
> (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
> (add-hook 'LaTeX-mode-hook #'my-latex-setup)
>
> in order to delay the customization to after the variable is defined.
Isn't this redundant? You call the function every time a LaTeX file is
loaded. The first method is preferrable, right?
Alessandro
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-04 22:16 ` Alessandro Bertulli
@ 2022-09-05 4:39 ` tomas
2022-09-05 9:16 ` Alessandro Bertulli
2022-09-05 11:45 ` Akib Azmain Turja
2022-09-05 14:43 ` Stefan Monnier
2 siblings, 1 reply; 23+ messages in thread
From: tomas @ 2022-09-05 4:39 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]
On Mon, Sep 05, 2022 at 12:16:31AM +0200, Alessandro Bertulli wrote:
>
> Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
>
> > `LaTeX-mode-map`, like most package variables, is only defined once
> > its package is actually loaded, which is done lazily in response to the
> > use of the package (e.g. opening a LaTeX file).
> >
> > So it's normal that `LaTeX-mode-map` is not defined when your init file
> > is loaded. This is on purpose to try and speed up Emacs's startup.
> >
> > You can use things like:
> >
> > (with-eval-after-load 'latex
> > (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
> > (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
>
> You honestly opened a world to me. I have long wondered the difference
> between require and with-eval-after-load (of course I could have read
> the docs, but I never found time). :-)
>
> > or
> >
> > (defun my-latex-setup ()
> > (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
> > (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
> > (add-hook 'LaTeX-mode-hook #'my-latex-setup)
> >
> > in order to delay the customization to after the variable is defined.
>
> Isn't this redundant? You call the function every time a LaTeX file is
> loaded. The first method is preferrable, right?
I think they are doing different things. There are things you want to
happen on each buffer when and once it becomes a "LaTeX buffer". Setting
buffer-local variables comes to mind.
And to nitpick a bit more: it doesn't happen when a LaTeX file is loaded,
but when LaTeX mode is "switched on", that can happen in other occassions
too (when creating a new buffer you know it will be LaTeX, but you can
also switch the mode on and off; LaTeX isn't a good example for the second).
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-05 4:39 ` tomas
@ 2022-09-05 9:16 ` Alessandro Bertulli
2022-09-05 18:51 ` tomas
0 siblings, 1 reply; 23+ messages in thread
From: Alessandro Bertulli @ 2022-09-05 9:16 UTC (permalink / raw)
To: tomas; +Cc: help-gnu-emacs
<tomas@tuxteam.de> writes:
>>
>> Isn't this redundant? You call the function every time a LaTeX file is
>> loaded. The first method is preferrable, right?
>
> I think they are doing different things. There are things you want to
> happen on each buffer when and once it becomes a "LaTeX buffer". Setting
> buffer-local variables comes to mind.
Sorry, I didn't understand: are you saying that defining keybindings is
one of those cases? Key maps are not buffer-local, are they? Or did I
miss something?
> And to nitpick a bit more: it doesn't happen when a LaTeX file is loaded,
> but when LaTeX mode is "switched on", that can happen in other occassions
> too (when creating a new buffer you know it will be LaTeX, but you can
> also switch the mode on and off; LaTeX isn't a good example for the second).
Sure, but that's not a problem, since even when creating a new LaTeX
file, I always open a .tex file.
Alessandro
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-04 6:32 ` Emanuel Berg
@ 2022-09-05 11:44 ` Akib Azmain Turja
0 siblings, 0 replies; 23+ messages in thread
From: Akib Azmain Turja @ 2022-09-05 11:44 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]
Emanuel Berg <incal@dataswamp.org> writes:
> Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>
>>> I installed it using package.el. Then for some reason I had
>>> problems configuring keybindings in LaTeX-mode-map: somehow
>>> the variable seemed to not be defined. I manually searched
>>> for it in the package (M-x grep-find iirc), then required
>>> the relevant files.
>>
>> `LaTeX-mode-map`, like most package variables, is only
>> defined once its package is actually loaded, which is done
>> lazily in response to the use of the package (e.g.
>> opening a LaTeX file).
>
> https://en.wikipedia.org/wiki/Lazy_loading
>
>> So it's normal that `LaTeX-mode-map` is not defined when
>> your init file is loaded. This is on purpose to try and
>> speed up Emacs's startup.
>
> Does it really make it that slow? Must be something from
> Emacs' past, maybe ...
>
> And besides you shouldn't restart Emacs all the time either?
>
> With this
>
> (require 'tex-mode)
> (define-key latex-mode-map "\C-c\C-c" #'compile)
>
> starting Emacs is almost instant.
But it always adds a little to your init time. When you configure too
many packages like this, these will cause the startup to take a long
time. I recommend:
--8<---------------cut here---------------start------------->8---
(with-eval-after-load 'tex-mode
(define-key latex-mode-map "\C-c\C-c" #'compile))
--8<---------------cut here---------------end--------------->8---
This will bind the key as soon as tex-mode is loaded.
--
Akib Azmain Turja
Find me on Mastodon at @akib@hostux.social.
This message is signed by me with my GnuPG key. Its fingerprint is:
7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-04 22:16 ` Alessandro Bertulli
2022-09-05 4:39 ` tomas
@ 2022-09-05 11:45 ` Akib Azmain Turja
2022-09-05 14:43 ` Stefan Monnier
2 siblings, 0 replies; 23+ messages in thread
From: Akib Azmain Turja @ 2022-09-05 11:45 UTC (permalink / raw)
To: Alessandro Bertulli; +Cc: Stefan Monnier, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]
Alessandro Bertulli <alessandro.bertulli96@gmail.com> writes:
> Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
>
>> `LaTeX-mode-map`, like most package variables, is only defined once
>> its package is actually loaded, which is done lazily in response to the
>> use of the package (e.g. opening a LaTeX file).
>>
>> So it's normal that `LaTeX-mode-map` is not defined when your init file
>> is loaded. This is on purpose to try and speed up Emacs's startup.
>>
>> You can use things like:
>>
>> (with-eval-after-load 'latex
>> (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
>> (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
>
> You honestly opened a world to me. I have long wondered the difference
> between require and with-eval-after-load (of course I could have read
> the docs, but I never found time). :-)
>
>> or
>>
>> (defun my-latex-setup ()
>> (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
>> (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
>> (add-hook 'LaTeX-mode-hook #'my-latex-setup)
>>
>> in order to delay the customization to after the variable is defined.
>
> Isn't this redundant? You call the function every time a LaTeX file is
> loaded. The first method is preferrable, right?
Yeah, the first one is IMHO better.
>
> Alessandro
>
--
Akib Azmain Turja
Find me on Mastodon at @akib@hostux.social.
This message is signed by me with my GnuPG key. Its fingerprint is:
7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-04 22:16 ` Alessandro Bertulli
2022-09-05 4:39 ` tomas
2022-09-05 11:45 ` Akib Azmain Turja
@ 2022-09-05 14:43 ` Stefan Monnier
2 siblings, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2022-09-05 14:43 UTC (permalink / raw)
To: Alessandro Bertulli; +Cc: help-gnu-emacs
>> (add-hook 'LaTeX-mode-hook #'my-latex-setup)
> Isn't this redundant? You call the function every time a LaTeX file
> is loaded. The first method is preferrable, right?
They each have their own advantages and disadvantages, but in most cases
the difference is lost way down in the noise.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Unicode characters for transcribing to pdf
2022-09-05 9:16 ` Alessandro Bertulli
@ 2022-09-05 18:51 ` tomas
0 siblings, 0 replies; 23+ messages in thread
From: tomas @ 2022-09-05 18:51 UTC (permalink / raw)
To: Alessandro Bertulli; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]
On Mon, Sep 05, 2022 at 11:16:45AM +0200, Alessandro Bertulli wrote:
>
> <tomas@tuxteam.de> writes:
> >>
> >> Isn't this redundant? You call the function every time a LaTeX file is
> >> loaded. The first method is preferrable, right?
> >
> > I think they are doing different things. There are things you want to
> > happen on each buffer when and once it becomes a "LaTeX buffer". Setting
> > buffer-local variables comes to mind.
>
> Sorry, I didn't understand: are you saying that defining keybindings is
> one of those cases? Key maps are not buffer-local, are they? Or did I
> miss something?
No, keybindings seem an adequate application for the former. If you were
limiting your question to that case, you are totally right, of course.
> > And to nitpick a bit more: it doesn't happen when a LaTeX file is loaded,
> > but when LaTeX mode is "switched on", that can happen in other occassions
> > too (when creating a new buffer you know it will be LaTeX, but you can
> > also switch the mode on and off; LaTeX isn't a good example for the second).
>
> Sure, but that's not a problem, since even when creating a new LaTeX
> file, I always open a .tex file.
You might do. An org-to-LaTeX converter, for one example, might be
doing it directly into a buffer.
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2022-09-05 18:51 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-31 14:32 Unicode characters for transcribing to pdf wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-31 15:28 ` Eric S Fraga
2022-08-31 16:04 ` uzibalqa
2022-08-31 16:31 ` Eric S Fraga
2022-08-31 16:49 ` uzibalqa
2022-08-31 17:27 ` tomas
2022-08-31 21:37 ` Joost Kremers
2022-09-01 4:18 ` uzibalqa
2022-09-01 9:12 ` Alessandro Bertulli
2022-09-01 12:04 ` Arash Esbati
2022-09-03 10:58 ` Alessandro Bertulli
2022-09-03 18:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-04 6:32 ` Emanuel Berg
2022-09-05 11:44 ` Akib Azmain Turja
2022-09-04 22:16 ` Alessandro Bertulli
2022-09-05 4:39 ` tomas
2022-09-05 9:16 ` Alessandro Bertulli
2022-09-05 18:51 ` tomas
2022-09-05 11:45 ` Akib Azmain Turja
2022-09-05 14:43 ` Stefan Monnier
[not found] ` <87edwve99q.fsf@gmail.com-NAsW-xw----2>
2022-09-01 11:35 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-09-03 10:54 ` Alessandro Bertulli
2022-09-01 13:05 ` Stefan Monnier via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).