pprevos / emacs-writing-studio

Emacs configuration for authors who research, write and publish articles, books and websites.
https://lucidmanager.org/tags/emacs/
GNU General Public License v3.0
476 stars 30 forks source link

Font display differs in different windows for org files. #14

Closed zenny closed 3 months ago

zenny commented 4 months ago

Hi,

  1. Just wondering whether it is by design or a bug that renders the display of org documents from your book in different fonts, one sans serif and the other in monospace font in EWS as evident from the screenshot below.

  2. The theme used is misterioso, yet it does not render in the same color scheme (but darker illegible) till I load the modus-operandi-tinted theme, fyi.

pic-selected-240725-1914-43

Thanks.

pprevos commented 4 months ago

This is by design and caused by the mixed-pitch package.

zenny commented 4 months ago

This is by design and caused by the mixed-pitch package.

@pprevos Thanks for your prompt response.

pprevos commented 4 months ago

Also, the theme can override some of these.

zenny commented 4 months ago

Btw, I read in https://github.com/jabranham/mixed-pitch that " It tries to be smart about which fonts get which face. Fonts that look like code, org-tables, and such remain fixed-pitch and everything else becomes variable-pitch."

But that does not seem to have been adhered by the mixed-pitch package in the as evident from the screenshot. Both are org files, yet the content of one is rendered in sans serif (04-ideation.org) and the other one completely in monospace (05-production.org).

Or did I miss something?

pprevos commented 4 months ago

Perhaps something did not activate. You can reset an Org file by hitting C-c C-c when the cursor is on the front matter. Themes can override these settings.

zenny commented 4 months ago

Perhaps something did not activate. You can reset an Org file by hitting C-c C-c when the cursor is on the front matter. Themes can override these settings.

Thanks for the pointer. I tried resetting the org file with C-c C-c, but without any change in the look, fyi.

The Backtrace shows:

Debugger entered--Lisp error: (error "File \"/tmp/orgtexCGxDyg.png\" wasn’t produced.  Ple...")
  error("File \"/tmp/orgtexCGxDyg.png\" wasn't produced.  Ple...")
  org-compile-file("/tmp/orgtexCGxDyg.pdf" ("convert -density %D -trim -antialias %f -quality 1...") "png" "Please adjust `luamagick' part of `org-preview-lat..." #<buffer *Org Preview LaTeX Output*> ((68 . "200.0") (83 . "1.4285714285714286")))
  org-create-formula-image("$$206.835 - 1.015 \\left( \\frac{\\text{words}}{\\text..." "/home/zenny/Downloads/emacs-configs/ihsec/ews/docu..." (:foreground "#e1e1e0" :background "#2d3743" :scale 2 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) forbuffer luamagick)
  org-format-latex("ltximg/org-ltximg" 1 61950 "/home/zenny/Downloads/emacs-configs/ihsec/ews/docu..." overlays nil forbuffer luamagick)
  org--latex-preview-region(1 61950)
  org-latex-preview((16))
  org-mode()
  org-mode-restart()
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  command-execute(org-ctrl-c-ctrl-c)
pprevos commented 4 months ago

I think I get it now. The right Org file has LaTeX formulas and EWS previews these by default. However, that requires you to install LaTeX.

I have removed LaTeX previews as defaults as it is something for advanced users: 203262a.

I hope this fixes the problem.

zenny commented 4 months ago

I think I get it now. The right Org file has LaTeX formulas and EWS previews these by default. However, that requires you to install LaTeX.

Entire latex-2024 packages are installed using tlmgr already. So this may not be an issue in my case. However I go with you.

I have removed LaTeX previews as defaults as it is something for advanced users: 203262a.

I got the following after disabling with org-startup-with-latex-preview nil:

Debugger entered--Lisp error: (void-function org-startup-with-latex-preview)
  (org-startup-with-latex-preview nil)
  eval-region(6226 6262)  ; Reading at buffer position 6262
  funcall-interactively(eval-region 6226 6262)
  command-execute(eval-region record)
  execute-extended-command(nil "eval-region" nil)
  funcall-interactively(execute-extended-command nil "eval-region" nil)
  command-execute(execute-extended-command)

After patching the init.el with 203262a, I ran C-c C-c to reload the same file, but without any change but with a backtrace as follow:

[203262a](https://github.com/pprevos/emacs-writing-studio/commit/203262a0caddc139a1c538856f7d374c19d7fadd)

I hope this fixes the problem.

pprevos commented 4 months ago

org-startup-with-latex-preview is not a function but a variable. Line 241 in init.el sets it at zero.

I just realised I have also enabled org-fragtog, which makes editing LaTeX formulas easier.

Question: Do you use LaTeX? If not, please remove Org-Fragtog and see if this solves it. I might have to make that package optional.

zenny commented 3 months ago

org-startup-with-latex-preview is not a function but a variable. Line 241 in init.el sets it at zero.

I just realised I have also enabled org-fragtog, which makes editing LaTeX formulas easier.

Question: Do you use LaTeX? If not, please remove Org-Fragtog and see if this solves it. I might have to make that package optional.

I do use LaTeX on times. Usually my multi-linguistic documents are in different written scripts. So I ought to change the org-export-pdf to lualatex which is not possible with the pdftex parser, fyi.

pprevos commented 3 months ago

I have no experience with luatex. I want to ensure the config works for people who don't use any LaTeX.

I am still unable the original issue you listed. I might have to use a spare laptop to test EWS on a box without LaTeX.

zenny commented 3 months ago

I have no experience with luatex. I want to ensure the config works for people who don't use any LaTeX.

I am still unable the original issue you listed. I might have to use a spare laptop to test EWS on a box without LaTeX.

FYI, I use the following in my local.el file to render outputs in different human language scripts:

(setq org-latex-pdf-process
  '("lualatex -shell-escape -interaction nonstopmode %f"
    "lualatex -shell-escape -interaction nonstopmode %f")) 

(setq luamagick '(luamagick :programs ("lualatex" "convert")
       :description "pdf > png"
       :message "you need to install lualatex and imagemagick."
       :use-xcolor t
       :image-input-type "pdf"
       :image-output-type "png"
       :image-size-adjust (1.0 . 1.0)
       :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
       :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))

(add-to-list 'org-preview-latex-process-alist luamagick)

(setq org-preview-latex-default-process 'luamagick)

Because pdftex asks for using lualatex when I try to render three scripts, namely, Roman, Devanagari and Bengali in the same document by specifying something like below for the header:

#+LaTeX_Header: \usepackage[english]{babel}
#+LaTeX_Header: \usepackage{fontspec}
#+LaTeX_Header: \babelprovide[onchar=ids fonts]{sanskrit-devanagari}
#+LaTeX_Header: \babelprovide[onchar=ids fonts,import,script=Bengali]{sanskrit-bengali}
#+LaTeX_Header: \babelfont[sanskrit-devanagari]{rm}{Noto Serif Devanagari}
#+LaTeX_Header: \babelfont[sanskrit-bengali]{rm}{Noto Serif Bengali}
#+LaTeX_Header: \defaultfontfeatures{Renderer=HarfBuzz}
#+LATEX_COMPILER: lualatex

Maybe this is something useful for those writers among your prospective users who writes in human languages which is other than the one that uses Roman scripts. Just my two cents.

pprevos commented 3 months ago

That is very interesting. I am not planning to explain how LaTeX works in the book.

Are you in Bangladesh? I worked there many years ago building the Bangabandhu Bridge.

Anyway, this ticket is about how Org display a buffer. Has that been resolved?

zenny commented 3 months ago

That is very interesting. I am not planning to explain how LaTeX works in the book.

Are you in Bangladesh?

Nope, yet I needed on times those languages due to anthropological reasons, fyi.

I worked there many years ago building the Bangabandhu Bridge.

Glad to know. Displays your contributions have reached far and wide. :-D

Anyway, this ticket is about how Org display a buffer. Has that been resolved?

Not yet. Anyway thanks for your attention. Have a nice weekend.

zenny commented 3 months ago

This issue maybe caused by the upstream (voidlinux) issue while compiling emacs. See https://github.com/void-linux/void-packages/issues/51727. When I compiled emacs myself in a traditional way than from the xbps package, it works like a charm. See screenshot below.

@pprevos, Sorry for the false alarm and the inconvenience caused. Cheers, /z

pic-selected-240809-0631-16

pprevos commented 3 months ago

No worries - glad you found the core issue.