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

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

Re: Orgmode + auctex + reftex + preview latex.


From: Partha Pratim Ghosh
Subject: Re: Orgmode + auctex + reftex + preview latex.
Date: Fri, 01 Jan 2021 22:18:06 +0200
User-agent: mu4e 1.2.0; emacs 26.3

Dear Hongyi,

Please find attached my .emacs configuration.

This is all that I need to use LaTeX in Org mode.

;;; emacs init file: Partha Pratim Ghosh


;; load emacs 24's package system. Add MELPA repository.
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://melpa.org/packages/";)
   '("melpa" . "http://melpa.milkbox.net/packages/";)
   )
 (package-initialize)  


;;; highlight coloring with zenburn theme
;;change highlight colour

(set-face-attribute 'region t :background "#164040")

;;; starting page must be agenda

(add-hook 'after-init-hook 'org-agenda-list)

;;; require snippets in global mode

(require 'yasnippet)
(yas-global-mode 1)


;;;;;;;; mu4e configuration
;;; load path for mu4e

(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
(require 'mu4e)

;;;; mu4e signatures
(defun my-mu4e-choose-signature ()
  "Insert one of a number of signatures"
  (interactive)
  (let ((message-signature
          (mu4e-read-option "Signature:"
            '(("formal" .
              (concat
           "Partha Pratim Ghosh\n"
           "School of Mathematical Sciences\n"
           "University of South Africa\n"
           "Florida Science Campus\n"
           "corner of Pioneer & Christiaan de Wet\n"
           "Florida, Gauteng, South Africa\n"
           "email: ghoshpp@unisa.ac.za\n"))
               ("informal" .
              "পার্থ প্রতিম ঘোষ\n")))))
    (message-insert-signature)))

(add-hook 'mu4e-compose-mode-hook
          (lambda () (local-set-key (kbd "C-c C-w") 
#'my-mu4e-choose-signature)))


;;; getting the mailing

(setq mu4e-get-mail-command "mbsync -a"
    mu4e-maildir (expand-file-name "~/Maildir")
    mu4e-update-interval 1800
    message-kill-buffer-on-exit t
    mu4e-use-fancy-chars t
    mu4e-headers-auto-update t
    )

(setq mu4e-compose-context-policy 'always-ask)

(setq mu4e-contexts
    (list
        (make-mu4e-context
        :name "personal"
        :enter-func (lambda () (mu4e-message "Entering UKZN context"))
        :leave-func (lambda () (mu4e-message "Leaving UKZN context"))
        :match-func (lambda (msg)
            (when msg
                (mu4e-message-contact-field-matches
                    msg '(:from :to :cc :bcc) 
"ghosh.parthapratim.ukzn@gmail.com")))
                        :vars '((user-mail-address . 
"ghosh.parthapratim.ukzn@gmail.com")
                            (user-full-name . "পার্থ প্রতিম ঘোষ")
                            (mu4e-sent-folder . "/ukzn/sent")
                            (mu4e-drafts-folder . "/ukzn/drafts")
                            (mu4e-trash-folder . "/ukzn/trash")
                            (mu4e-refile-folder . "/ukzn/archives")
                            (mu4e-maildir-shortcuts . ( ("/ukzn/INBOX"    . ?i)
                                                        ("/ukzn/sent"     . ?s)
                                                        ("/ukzn/trash"    . ?t)
                                                        ("/ukzn/archives" . ?a)
                                                        ("/ukzn/drafts"   . ?d)
                        ))))

        (make-mu4e-context
        :name "work"
        :enter-func (lambda () (mu4e-message "Entering UNISA context"))
        :leave-func (lambda () (mu4e-message "Leaving UNISA context"))
        :match-func (lambda (msg)
            (when msg
                (mu4e-message-contact-field-matches
                    msg '(:from :to :cc :bcc) 
"ghosh.parthapratim.unisa@gmail.com")))
                        :vars '((user-mail-address . 
"ghosh.parthapratim.unisa@gmail.com")
                            (user-full-name . "Partha Pratim Ghosh")
                            (mu4e-sent-folder . "/unisa/sent")
                            (mu4e-drafts-folder . "/unisa/drafts")
                            (mu4e-trash-folder . "/unisa/trash")
                            (mu4e-refile-folder . "/unisa/archives")
                            (mu4e-maildir-shortcuts . ( ("/unisa/INBOX"     . 
?i)
                                                        ("/unisa/sent"      . 
?s)
                                                        ("/unisa/trash"     . 
?t)
                                                        ("/unisa/archives"  . 
?a)
                                                        ("/unisa/drafts"    . 
?d)
                        ))))
                        ))

; use msmtp
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/usr/bin/msmtp")

;; don't save messages to Sent Messages, Gmail/IMAP takes care of this
(setq mu4e-sent-messages-behavior 'delete)

;; tell mu4e how to handle html2text
(setq mu4e-html2text-command 'mu4e-shr2text)

;; mu4e behaviour
(setq mu4e-split-view 'horizontal)
  (setq mu4e-headers-visible-lines 15)
  (setq mu4e-completing-read-function 'completing-read)
  (setq mu4e-headers-fields '((:human-date . 12)
                              (:flags . 6)
                              (:mailing-list . 15)
                              (:from-or-to . 22)
                              (:size . 8)
                              (:subject)))

  ;; save attachment to Downloads
  (setq mu4e-attachment-dir (expand-file-name "~/Downloads"))

  ;; attempt to show images when viewing messages
  (setq mu4e-view-show-images t)

;; allows to see attached patches etc more easily inline and also inline
  ;; PGP
  (setq mu4e-view-use-gnus t)

  ;; show full addresses in message view
  (setq mu4e-view-show-addresses t)

;;rename files when moving
;;NEEDED FOR MBSYNC
(setq mu4e-change-filenames-when-moving t)

;;set up queue for offline email
;;use mu mkdir  ~/Maildir/queue to set up first
(setq smtpmail-queue-mail nil  ;; start in normal mode
      smtpmail-queue-dir   "~/Maildir/queue/cur")

;; enable inline images in mu4e
(setq mu4e-view-show-images t)


;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; org mode configurations
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(require 'ox-latex)

(add-to-list 'org-latex-classes
             '("bjmarticle"
               "\\documentclass{article}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t) (latex . t))
 )

;;; org-mode + mu4e for managing todo and schedules

;;store org-mode links to messages
(require 'org-mu4e)
;;store link to message if in header view, not to header query
(setq org-mu4e-link-query-in-headers-mode nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-mode agenda options                                                ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;open agenda in current window
(setq org-agenda-window-setup (quote current-window))

;;warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)

;;show me tasks scheduled or due in next fortnight
(setq org-agenda-span (quote fortnight))

;;don't show tasks as scheduled if they are already shown as a deadline
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)

;;don't give a warning colour to tasks with impending deadlines
;;if they are scheduled to be done

(setq org-agenda-skip-deadline-prewarning-if-scheduled (quote pre-scheduled))

;;don't show tasks that are scheduled or have deadlines in the
;;normal todo list

(setq org-agenda-todo-ignore-deadlines (quote all))
(setq org-agenda-todo-ignore-scheduled (quote all))

;;sort tasks in order of when they are due and then by priority

(setq org-agenda-sorting-strategy
  (quote
   ((agenda deadline-up priority-down)
    (todo priority-down category-keep)
    (tags priority-down category-keep)
    (search category-keep))))

(setq org-capture-templates
      '(("t" "todo" entry (file+headline "~/todo.org" "Tasks")
         "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil 
t \"+0d\"))\n%a\n")))



;;; make reftex available
(require 'reftex)

;;; make reftex always on in AUcTeX

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

;;; LaTeX section hook

(setq LaTeX-section-hook
      '(LaTeX-section-heading
        LaTeX-section-title
        LaTeX-section-toc
        LaTeX-section-section
        LaTeX-section-label))

;;; LaTeX Mathematics Mode hooks

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(LaTeX-clean-output-suffixes '("\\.dvi" "\\.pdf" "\\.ps" "\\.xdv" "\\.xyc"))
 '(LaTeX-default-options '("12pt, dvipsnames"))
 '(LaTeX-electric-left-right-brace t)
 '(LaTeX-menu-max-items 30)
 '(LaTeX-section-hook
   '(LaTeX-section-heading LaTeX-section-title LaTeX-section-toc 
LaTeX-section-section LaTeX-section-label))
 '(LaTeX-section-label
   '(("part" . "part:")
     ("chapter" . "chap:")
     ("section" . "sec:")
     ("subsection" . "ssec:")
     ("subsubsection" . "sssec:")
     ("paragraph" . "para:")
     ("subparagraph" . "spara:")))
 '(TeX-auto-private
   '("/home/partha/.emacs.d/auctex/auto" 
"/home/partha/Documents/tex/essentials/"))
 '(TeX-braces-user-association nil)
 '(TeX-date-format "%d/%m/%Y")
 '(TeX-electric-escape t)
 '(TeX-electric-math '("$" . "$"))
 '(TeX-electric-sub-and-superscript t)
 '(TeX-macro-global
   '("/home/partha/texlive/texmf-local/tex/" 
"/home/partha/texlive/texmf-local/bibtex/bst/"))
 '(TeX-macro-private '("/home/partha/Documents/tex/essentials/"))
 '(TeX-mode-hook '(prettify-symbols-mode))
 '(TeX-style-path
   '("~/.emacs.d/auctex" "/home/partha/.emacs.d/elpa/auctex-12.3.1/style" 
"/home/partha/.emacs.d/auctex/auto" "/home/partha/.emacs.d/auctex/style" "auto" 
"style" "/home/partha/Documents/tex/essentials/"))
 '(TeX-style-private
   '("/home/partha/.emacs.d/auctex/style" 
"/home/partha/Documents/tex/essentials/"))
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(current-language-environment "Bengali")
 '(desktop-restore-frames t)
 '(doc-view-continuous t)
 '(flyspell-after-incorrect-word-string nil)
 '(flyspell-before-incorrect-word-string "-->>")
 '(flyspell-default-dictionary "british")
 '(font-use-system-font t)
 '(global-visual-line-mode t)
 '(latex-indent-within-escaped-parens t)
 '(org-agenda-files '("~/orgmode/agenda/agenda.org"))
 '(org-latex-packages-alist
   '(("utf8" "inputenc" nil)
     ("T1" "fontenc" nil)
     ("dvipsnames" "xcolor" nil)
     ("" "graphicx" nil)
     ("" "longtable" nil)
     ("" "hyperref" nil)
     ("style=numeric, backend=biber, backref=true, bibencoding=utf8, 
maxbibnames=6, sorting=nyt" "biblatex" nil)
     ("" "/home/partha/Documents/tex/essentials/symbols" nil)
     ("all,pdf" "xy" nil)
     ("" "amsbsy" nil)
     ("" "amsfonts" nil)
     ("" "amssymb" nil)
     ("" "amsmath" nil)
     ("" "bbold" nil)
     ("" "bbm" nil)
     ("" "mathtools" nil)
     ("" "stmaryrd" nil)
     ("" "xspace" nil)))
 '(package-selected-packages
   '(org-noter-pdftools pdf-view-restore exec-path-from-shell auctex 
elpa-mirror pdf-tools smartparens hydra excorporate easy-kill djvu dismal 
cycle-quotes csv-mode context-coloring company-statistics company-math 
bug-hunter beacon auto-correct ascii-art-to-unicode ahungry-theme 
aggressive-indent adjust-parens adaptive-wrap))
 '(preview-transparent-border 1.8)
 '(reftex-auto-recenter-toc 'frame)
 '(reftex-cite-cleanup-optional-args nil)
 '(reftex-cite-format 'biblatex)
 '(reftex-default-bibliography
   '("~/Documents/tex/essentials/bib-algebra.bib" 
"~/Documents/tex/essentials/bib-category.bib" 
"~/Documents/tex/essentials/bib-frames.bib" 
"~/Documents/tex/essentials/bib-self.bib" 
"~/Documents/tex/essentials/bib-topology.bib"))
 '(reftex-default-context-regexps
   '((caption . "\\\\\\(rot\\|bi\\)?\\(sub\\)?caption\\(box\\)?\\*?[[{]")
     (item . "\\\\item\\(\\[[^]]*\\]\\)?")
     (eqnarray-like . "\\\\begin{%s}\\|\\\\\\\\")
     (alignat-like . "\\\\begin{%s}{[0-9]*}\\|\\\\\\\\")
     (Thm . "\\\\begin{%s}\\|\\\\\\\\")
     (Prop . "\\\\begin{%s}\\|\\\\\\\\")
     (Lemma . "\\\\begin{%s}\\|\\\\\\\\")
     (Cor . "\\\\begin{%s}\\|\\\\\\\\")
     (Df . "\\\\begin{%s}\\|\\\\\\\\")
     (rem . "\\\\begin{%s}\\|\\\\\\\\")
     (Ex . "\\\\begin{%s}\\|\\\\\\\\")))
 '(reftex-plug-into-AUCTeX t)
 '(reftex-section-prefixes
   '((0 . "part:")
     (1 . "cha:")
     (2 . "sec:")
     (3 . "ssec:")
     (4 . "sssec:")
     (5 . "para:")
     (6 . "spara:")))
 '(reftex-toc-keep-other-windows nil)
 '(reftex-toc-split-windows-fraction 0.54)
 '(reftex-toc-split-windows-horizontally t)
 '(save-place-mode t nil (saveplace))
 '(show-paren-mode t)
 '(size-indication-mode t)
 '(tabbar-mode t nil (tabbar))
 '(tex-bibtex-command "biber")
 '(tex-dvi-view-command
   '(cond
     ((eq window-system 'x)
      "xreader")
     ((eq window-system 'w32)
      "yap")
     (t "dvi2tty * | cat -s")))
 '(tex-run-command "pdflatex"))

;;; saving and restoring desktops
;; use only one desktop
(setq desktop-path '("~/.emacs.d/"))
(setq desktop-dirname "~/.emacs.d/")
(setq desktop-base-file-name "emacs-desktop")
(desktop-save-mode 1)
(setq desktop-auto-save-timeout 600)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

;;; make pdf-tools default

(pdf-tools-install)

(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
      TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view))
      TeX-source-correlate-start-server t)

(add-hook 'TeX-after-compilation-finished-functions
          #'TeX-revert-document-buffer)


;;; setting the font for emacs modes

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "Ubuntu Mono" :foundry "DAMA" :slant normal :weight 
normal :height 241 :width normal)))))
 
Since I have now displayes the emcas init file, please allow me to
re-iterate the problems that I face:

1. The same notes, if I want to export to html does not do so
   effectively, since I use my personal .sty file, which is incorporated
   for LaTeX export but does not suit for the hrml export. So, a macro from
   my .sty file just gets typed as is in the html file. Also, Xypic codes
   get transferred to actual images in LaTeX export, but in the html export
   gets treated as a piece of code.

2. I have also problems with file links in the Org mode and it is not
   recognised. However, hyperref recognises the http links or doi links.


With my regards and all the very best wishes,

partha
Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> On Tue, Dec 29, 2020 at 5:34 PM Partha Pratim Ghosh
> <ghosh.parthapratim.unisa@gmail.com> wrote:
>>
>> Dear All & Hongyi,
>>
>> I use AucTeX for my major LaTeX projects and Org mode for smaller ones
>> as well as compiling reading notes et al. For such short and brief ones
>> I find the Org mode LaTeX export to be very handy. I can share my
>> configuration separately, if you are interested, and did not do so here
>> fearing the mail/reply becoming too long and boring.
>
> Could you please share your configuration on github, so that people
> here can try/discuss it more conveniently If they want to?
>
>>
>> I have a few problems though:
>>
>> 1. The same notes, if I want to export to html does not do so
>> effectively, since I use my personal .sty file, which is incorporated
>> for LaTeX export but does not suit for the hrml export. So, a macro from
>> my .sty file just gets typed as is in the html file. Also, Xypic codes
>> get transferred to actual images in LaTeX export, but in the html export
>> gets treated as a piece of code.
>>
>> 2. I have also problems with file links in the Org mode and it is not
>> recognised. However, hyperref recognises the http links or doi links.
>>
>> I would be thankful if I could find some help here in solving the two
>> problems above.
>>
>>
>> With my regards and all the very best wishes,
>>
>> partha
>>
>> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>>
>> > On Mon, Dec 28, 2020 at 1:09 PM David Masterson
>> > <dsmasterson92630@outlook.com> wrote:
>> >>
>> >> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>> >>
>> >> > Orgmode is powerful and great, but if I want to write latex from
>> >> > within it, I also want to utilize the capabilities supplied by, e.g.,
>> >> > auctex, reftex, preview latex and so on.
>> >> >
>> >> > Any hints/notes/comments for the co-operation and combination of these
>> >> > tools will be highly appreciated.
>> >>
>> >> Haven't used it, but this is a problem that sounds like mmm-mode (on
>> >> Melpa) is for,
>> >
>> > Thanks for your notes. I've filed an issue to the author of mmm-mode:
>> > https://github.com/purcell/mmm-mode/issues/120.
>> >
>> > Regards
>>


reply via email to

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