- Questo topic ha 14 risposte, 7 partecipanti ed è stato aggiornato l'ultima volta 15 anni, 6 mesi fa da
Elrond.
-
CreatoreTopic
-
31 Ottobre 2010 alle 12:03 #51849::
Ciao a tutti,anzitutto una breve presentazione: mi chiamo Andrea, in passato avevo già usato latex per scrivere la mia tesi di laurea, oggi voglio tornare ad usare latex per scrivere delle piccole relazioni di calcolo.
Ai tempi della tesi, dopo aver provato diversi editor ero arrivato ad usare emacs+auctex; oggi, come allora, dopo aver provato varie alternative sono tornato ad usare emacs+auctex, che mi sembra ancora l’accoppiata migliore per i miei scopi… e poi conosco già emacs, per cui la parte più difficile è scavalcata 😉
Siccome ho incontrato alcuni problemucci e la documentazione che si trova non mi sembra recentissima, penso sia cosa gradita mettere qui come li ho risolti – vale a dire, metto qui il mio file .emacs
`
(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-indent-level 4)
'(LaTeX-item-indent -4)
'(LaTeX-left-right-indent-level 4)
'(LaTeX-mode-hook (quote (flyspell-mode reftex-mode outline-minor-mode TeX-fold-mode)))
'(TeX-auto-untabify t)
'(TeX-master nil)
'(TeX-parse-self t)
'(ispell-program-name “aspell”)
'(reftex-plug-into-AUCTeX t))
(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.
)
`Anzitutto, io uso linux Debian, nell’attuale versione Testing (squeeze).
Faccio notare che le variabili sono impostate attraverso “custom”, la funzione di customizzazione di emacs; di solito le soluzioni che si trovano nei vari siti sono indipendenti da custom, ma aggiungere “a mano” gli opportuni comandi nel file .emacs potrebbe portare a dei piccoli problemi con custom, e mi sembra meglio usare il sistema integrato in emacs piuttosto che smanacciare sui files di configurazione, sporattutto se non si capisce bene cosa si sta facendo.Per prima cosa, ho messo le indentazioni di 4 caratteri, il default di 2 mi sembra un po’ poco.
Poi faccio in modo che, all’apertura di un file latex (o meglio quando viene attivato il “latex-mode”) avvio flyspell (correzione ortografica mentre si scrive), reftex (gestione dei riferimenti); attivo anche outline-minor-mode e tex-fold-mode, che gestiscono il “folding”, ovvero mostrano o nascondono le varie parti del documento in maniera gerarchica. Probabilmente dei due ne basta uno, io li sto provando entrambi per vedere quale è più comodo – ad una prima impressione outline mi sembra migliore.
TeX-auto-untabify t : sostituisce le tabulazioni con degli spazi
TeX-master nil : impostazione per la gestione dei files multipli
TeX-parse-self t : impostazione “di comodità” per la scansione del file
ispell-program-name “aspell” : uso aspell al posto di ispell per il problema della correzione ortografica delle parole accentate; ogni moderna distribuzione dovrebbe avere già impacchettato aspell e il dizionario italiano, per cui la soluzione dovrebbe essere plug-and-play per tutti.
Tra l’altro, la soluzione riportata sul sito per me non ha funzionato, e mi sembra anche che manchino delle virgolette nella riga [A-Za-zAEÉIOUàèéìòù]” “[^A-Za-zAEÉIOUàèéìòù]”reftex-plug-into-AUCTeX t : attivo le funzioni di reftex in auctex
Trovo anche comodo attivare la speedbar, per navigare tra i vari files: M-x speedbar
E questo è quanto, spero che possa essere utile anche ad altri 😀
Ciao
Andrea
-
CreatoreTopic
-
AutoreRisposte
-
-
31 Ottobre 2010 alle 12:18 #51850::
Bella iniziativa, chissà se riusciamo a convincere altri a usare Emacs in questo modo 😀
Anche io qualche giorno fa sul mio blog avevo postato le impostazioni che ho aggiunto nel mio .emacs: http://elubuntu.blogspot.com/2010/10/opzioni-utili-per-comporre-documenti.html
-
12 Novembre 2010 alle 19:41 #51851::
Il mio init.el per ora è: `;;*********************************************************************** ;;
;; Filename : init.el ;;
;; Description: Emacs init file ;;
;; Author : Nome Cognome ;;
;; Maintainer : Nome Cognome ;;
;; Copyright (C) 2010, Nome Cognome, all rights reserved. ;;
;; *********************************************************************** ;;;; Associa comandi o caratteri a particolari tasti
(global-set-key [f2] “~”)
(global-set-key [f4] 'goto-line);; Togliere il messaggio di benvenuto iniziale
(setq inhibit-startup-message t);; Salvare il file ogni 200 battute di tasti
(setq auto-save-interval 200);; Attivare di default pdfLaTeX
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode);; Impostare il rientro pari ad un carattere
(custom-set-variables '(LaTeX-indent-level 1))(setq fill-column 76)
;; Andare a capo se si superano 76 caratteri
(add-hook 'TeX-mode-hook 'turn-on-auto-fill);; Attivare RefTeX
(add-hook 'latex-mode-hook 'turn-on-reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
;(setq reftex-plug-into-auctex t);; Attivare di default la modalità math
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode);; Creare una directory con informazioni sui pacchetti
(setq TeX-auto-save t)
(setq TeX-parse-self t);; Chiedere qual è il master file
(setq-default TeX-master nil);; Numeri di colonna sulla barra in basso
(column-number-mode t);; Evidenziare le parentesi
(show-paren-mode t)
;; Mostrare la data e l'ora sulla barra in basso
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
(setq european-calender-style t)(setq font-latex-fontify-sectioning 'color)
;; End of init.el`Aspetto vostri consigli su come migliorarlo.
Ciao,
Orlando
-
8 Gennaio 2011 alle 22:50 #51852::
Ciao a tutti!Uso Aquamacs su Mac come editor per latex. Per aquamacs ci sono due file Preferences.el e customizations.el. Vengono divisi tra questi due file le impostazioni che di solito si mettono su .emacs. Queste sono le mie impostazioni di Preference.el
`(load “auctex.el” nil t t)
(load “preview-latex.el” nil t t)(require 'desktop)
(desktop-save-mode t)
(desktop-read)
(setq desktop-load-locked-desktop t)(require 'saveplace)
(setq-default save-place t)
(savehist-mode t)(require 'reftex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-enable-partial-scans t)
(setq reftex-save-parse-info t)
(setq reftex-use-multiple-selection-buffers t)(add-hook 'LaTeX-mode-hook (lambda ()
(TeX-fold-mode 1)))
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq reftex-trust-label-prefix t)(setq LaTeX-math-mode t)
(setq reftex-plug-into-auctex t)(setq reftex-label-alist
'((“defin” ?d “D:” “~\\ref{%s}” nil (“Definition” “Definitions” “definition” “Def.”))
(“thm” ?h “T:” “~\\ref{%s}” t (“Theorem” “thm.” “Th.”))
(“ex” ?z “E:” “~\\ref{%s}” t (“Example” “Examples” “example” “Ex.”))
(“prop” ?p “P:” “~\\ref{%s}” t (“Proposition” “Examples” “Prop.” “prop.”))
(“cor” ?x “C:” “~\\ref{%s}” t (“Problem” “Prob,” “prob” “Exercise” “exercise”))
(“conj” ?y “conj:” “~\\ref{%s}” t (“Conjecture” “Conj” “conj”))
(“lemma” ?l “L:” “~\\ref{%s}” t (“Lemma” “lemma”))
(“remark” ?r “R:” “~\\ref{%s}” t (“Remark” “remark” “rem”))))(add-hook 'LaTeX-mode-hook
(lambda ()
(LaTeX-add-environments
'(“cor” LaTeX-env-label)
'(“ex” LaTeX-env-label)
'(“thm” LaTeX-env-label)
'(“prop” LaTeX-env-label)
'(“defin” LaTeX-env-label)
'(“conj” LaTeX-env-label)
'(“lemma” LaTeX-env-label)
'(“remark” LaTeX-env-label))))(autoload 'flyspell-mode “flyspell” “On-the-fly spelling checker.” t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)(add-hook 'TeX-mode-hook
(function
(lambda ()
(local-set-key “\C-c\C-i” 'TeX-complete-symbol)
)))(require 'linum)
(global-linum-mode 1)
(setq linum-format (lambda (line) (propertize (format (let ((w (length (number-to-string (count-lines (point-min) (point-max)))))) (concat “%” (number-to-string w) “d “)) line) 'face 'linum)))(setq search-highlight t) ; Highlight search object
(setq query-replace-highlight t) ; Highlight query object(global-visual-line-mode 1)
(setq font-lock-maximum-decoration t)
(setq TeX-auto-save t)
(setq TeX-save-query nil)
`e queste quelle di customizations.el:
`
(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-math-abbrev-prefix “£”)
'(aquamacs-additional-fontsets nil t)
'(aquamacs-customization-version-id 210 t)
'(aquamacs-tool-bar-user-customization (quote ((4194530 open-file save-buffer nil cut copy paste undo nil latex view bibtex preview) (37748974 Set\ for\ current\ session Save\ for\ future\ sessions Undo\ edits Reset\ to\ saved Erase\ customizations Help\ for\ Customize Exit))) t)
'(default-frame-alist (quote ((cursor-type . box) (width . 100) (height . 35) (vertical-scroll-bars . right) (internal-border-width . 0) (fringe) (modeline . t) (mouse-color . “black”) (background-mode . light) (tool-bar-lines . 1) (menu-bar-lines . 1) (right-fringe . 0) (left-fringe . 0) (cursor-color . “Red”) (background-color . “White”) (foreground-color . “Black”) (font . “-apple-Lucida_Grande-medium-normal-normal-*-15-*-*-*-p-0-iso10646-1”) (fontsize . 0) (font-backend ns))))
'(emulate-mac-italian-pro-keyboard-mode t)
'(global-hl-line-mode t)
'(global-linum-mode t)
'(ns-tool-bar-display-mode (quote both) t)
'(ns-tool-bar-size-mode (quote regular) t)
'(visual-line-mode nil t))
(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.
'(autoface-default ((t (:inherit default))))
'(latex-mode-default ((t (:inherit text-mode-default :height 150 :family “Lucida Grande”))))
'(linum ((t (:inherit (shadow default) :inverse-video t)))))(kill-buffer “*scratch*”)
(setq skeleton-pair t)
(setq skeleton-pair-on-word t)
(global-set-key “[” 'skeleton-pair-insert-maybe)
(global-set-key “{” 'skeleton-pair-insert-maybe)
(global-set-key “(” 'skeleton-pair-insert-maybe)
(global-set-key “\”” 'skeleton-pair-insert-maybe)(define-skeleton Tex-dollar-sign-skeleton
“Make a pair of dollar signs and leave point inside” nil
“$”_”$”)
(global-set-key (kbd “C-x e”) 'Tex-dollar-sign-skeleton)(define-skeleton TeX-square-skeleton
“Make a pair of square brackets and leave point inside” nil
“\\[” \n
_ \n
“\\]”)
(global-set-key (kbd “C-x s”) 'TeX-square-skeleton)(define-skeleton TeX-graffe-skeleton
“Make a pair of parenthesys and leave point inside” nil
“\\{“_”\\}”)
(global-set-key (kbd “C-x g”) 'TeX-graffe-skeleton)(define-skeleton mat1
“Insert matrix” nil
“\\[\n\\left(\n\\begin{array}{ccc}\n\t”_”\n\\end{array}\n\\right)\n\\]”
)
(global-set-key (kbd “C-x ar1”) 'mat1)(define-skeleton mat2
“Insert matrix” nil
“\\left(\n\\begin{array}{ccc}\n\t”_”\n\\end{array}\n\\right)”
)
(global-set-key (kbd “C-x ar2”) 'mat2)(define-skeleton mult*
“Insert an multiline* in latex”
nil
“\\begin{multline*}\n\t”_”\t\n\\end{multline*}\n”)
(global-set-key (kbd “C-x y”) 'mult*)(define-skeleton rid
“Insert stackrel+riducendo”
nil
“\\stackrel{\\text{riducendo}}{\\longmapsto}\n”)
(global-set-key (kbd “C-x t”) 'rid)(define-skeleton rid2
“Insert stackrel+riducendo”
nil
“\\xrightarrow{\\scriptsize{\\begin{aligned}\n”_”\n\\end{aligned}}}”)
(global-set-key (kbd “C-x x”) 'rid2)(define-skeleton virg
“Inserire virgolette”
nil
“`”)
(global-set-key (kbd “C-x c”) 'virg)(defun duplicate-line()
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(newline)
(yank)
)
(global-set-key (kbd “C-d”) 'duplicate-line)
`Ma tutto è in continua evoluzione. 🙂
-
15 Gennaio 2011 alle 16:24 #51853
-
16 Gennaio 2011 alle 14:37 #51854::
Spiego alcuni comandi dei comandi del post precedente. Tenete presente che sono cose che ho preso qua e là. Quindi, potrebbero non essere perfetti, anzi.Questo fa sì che quando uso l’ambiente defin e faccio C-c ( per inserire label mi dia \label{D:un numero}, con thm \label{T:un numero} e così via.
(setq reftex-label-alist
‘((“defin” ?d “D:” “~\\ref{%s}” nil (“Definition” “Definitions” “definition” “Def.”))
(“thm” ?h “T:” “~\\ref{%s}” t (“Theorem” “thm.” “Th.”))
(“ex” ?z “E:” “~\\ref{%s}” t (“Example” “Examples” “example” “Ex.”))
(“prop” ?p “P:” “~\\ref{%s}” t (“Proposition” “Examples” “Prop.” “prop.”))
(“cor” ?x “C:” “~\\ref{%s}” t (“Problem” “Prob,” “prob” “Exercise” “exercise”))
(“conj” ?y “conj:” “~\\ref{%s}” t (“Conjecture” “Conj” “conj”))
(“lemma” ?l “L:” “~\\ref{%s}” t (“Lemma” “lemma”))
(“remark” ?r “R:” “~\\ref{%s}” t (“Remark” “remark” “rem”))))(add-hook ‘LaTeX-mode-hook
(lambda ()
(LaTeX-add-environments
‘(“cor” LaTeX-env-label)
‘(“ex” LaTeX-env-label)
‘(“thm” LaTeX-env-label)
‘(“prop” LaTeX-env-label)
‘(“defin” LaTeX-env-label)
‘(“conj” LaTeX-env-label)
‘(“lemma” LaTeX-env-label)
‘(“remark” LaTeX-env-label))))Questo comando:
(define-skeleton Tex-dollar-sign-skeleton
“Make a pair of dollar signs and leave point inside” nil
“$”_”$”)
(global-set-key (kbd “C-x e”) ‘Tex-dollar-sign-skeleton)fa sì che con C-x e inserisco $ $ con uno spazio nel mezzo e il cursore tra i due $.
Con questo con C-x s:
(define-skeleton TeX-square-skeleton
“Make a pair of square brackets and leave point inside” nil
“\\[” \n
_ \n
“\\]”)
(global-set-key (kbd “C-x s”) ‘TeX-square-skeleton)inserisco
\[
spazio vuoto e cursore qui.
\]Con questo:
(define-skeleton TeX-graffe-skeleton
“Make a pair of parenthesys and leave point inside” nil
“\\{“_”\\}”)
(global-set-key (kbd “C-x g”) ‘TeX-graffe-skeleton)con C-x g faccio:
\{ spazio vuoto e cursore qui \}Con questo:
(define-skeleton mat1
“Insert matrix” nil
“\\[\n\\left(\n\ PROTECTED0 \n\\right)\n\\]”
)
(global-set-key (kbd “C-x ar1”) ‘mat1)con C-x ar1 inserisco:
\[
\left(
PROTECTED1
\right)
\]Con questo:
(define-skeleton mat2
“Insert matrix” nil
“\\left(\n\\begin{array}{ccc}\n\t”_”\n\\end{array}\n\\right)”
)
(global-set-key (kbd “C-x ar2”) ‘mat2)con C-x ar2 inserisco:
\left(
\begin{array}{ccc}
SPAZIO VUOTO E CURSORE QUI
\end{array}
\right)Con:
(define-skeleton mult*
“Insert an multiline* in latex”
nil
“\\begin{multline*}\n\t”_”\t\n\\end{multline*}\n”)
(global-set-key (kbd “C-x y”) ‘mult*)con C-x y inserisco l’ambiente multline* con, al solito, il cursore nel mezzo.
Con:
(define-skeleton rid
“Insert stackrel+riducendo”
nil
“\\stackrel{\\text{riducendo}}{\\longmapsto}\n”)
(global-set-key (kbd “C-x t”) ‘rid)con C-x t inserisco \stackrel{\text{riducendo}}{\longmapsto} e il cursore è a capo.
Con
(define-skeleton rid2
“Insert stackrel+riducendo”
nil
“\\xrightarrow{\\scriptsize{\\begin{aligned}\n”_”\n\\end{aligned}}}”)
(global-set-key (kbd “C-x x”) ‘rid2)con C-x x inserisco:
xrightarrow{\scriptsize{\begin{aligned}
CURSORE QUI
\end{aligned}}}Con:
(define-skeleton virg
“Inserire virgolette”
nil
“`”)
(global-set-key (kbd “C-x c”) ‘virg)con C-x c inserisco `.
Infine, con:
(defun duplicate-line()
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(newline)
(yank)
)
(global-set-key (kbd “C-d”) ‘duplicate-line)con C-d duplico la linea su cui si trova il cursore in quel momento.
-
16 Gennaio 2011 alle 19:25 #51855
-
16 Gennaio 2011 alle 21:26 #51856::
Bella spiegazione. Non ho ancora provato, ma qualche tua personalizzazione mi interessa.
Grazie,
ansys.Figurati! Senza alcune di queste cose non saprei come fare. Risparmio veramente tempo con quei comandi. Mi sono avvicinata a emacs (e poi aquamacs) per il preview, ma adesso non lo uso praticamente più e non posso più stare senza questi comandi.
-
16 Gennaio 2011 alle 22:11 #51857::
In effetti quei `define-skeleton’ sono molto interessanti! Per approfondire ho trovato questo: http://www.emacswiki.org/emacs/SkeletonMode (c’è qualcosa anche nell’info di Autotype consultabile con `C-h i d m Autorype RET’). Grazie!
-
18 Gennaio 2011 alle 4:20 #51858
-
14 Febbraio 2011 alle 14:59 #51859::
Ciao a tutti e grazie per la discussione davvero interessante.
Visto che siete piuttosto esperti provo a porvi un quesito su emacs + auctex che non riesco a risolvere (nonostante giorni di ricerche)
Sto scrivendo la tesi di dottorato e non so per quale motivo non mi fa la preview delle equazioni. O meglio, solo di quelle del tipo
`\begin{equation}
…
\end{equation}`
mentre nessun problema per $…$.
Ora non capisco di che si tratti, perché in tutti gli altri documenti non ho questo tipo di problema, solo nella tesi.
La tesi è strutturata con un documento master nel quale includo i vari capitoli.
Se nella tesi cerco di fare la preview di
`\begin{equation}
1
\end{equation}`
nel file _regione_.tex leggo:
`
\message{!name(Capitolo.tex) !offset(-79)}
\begin{equation}
1
\end{equation}
\message{!name(…/master.tex) !offset(115)}
`
So che spiegata così è molto vaga: non so se è un problema comune o se dipende dalle impostazioni della tesi. Leggendo in giro, molti consigliano di mettere mano ai file .el nei modi più fantasiosi, per questo ho postato qui. Io non ci capisco nulla…
Grazie per qualsiasi suggerimento!
PS uso emacs 23 su ubuntu.
-
14 Febbraio 2011 alle 15:34 #51860::
Ciao a tutti e grazie per la discussione davvero interessante.
Visto che siete piuttosto esperti provo a porvi un quesito su emacs + auctex che non riesco a risolvere (nonostante giorni di ricerche)
Sto scrivendo la tesi di dottorato e non so per quale motivo non mi fa la preview delle equazioni. O meglio, solo di quelle del tipo
`\begin{equation}
…
\end{equation}`
mentre nessun problema per $…$.
Ora non capisco di che si tratti, perché in tutti gli altri documenti non ho questo tipo di problema, solo nella tesi.
La tesi è strutturata con un documento master nel quale includo i vari capitoli.
Se nella tesi cerco di fare la preview di
`\begin{equation}
1
\end{equation}`
nel file _regione_.tex leggo:
`
\message{!name(Capitolo.tex) !offset(-79)}
\begin{equation}
1
\end{equation}
\message{!name(…/master.tex) !offset(115)}
`
So che spiegata così è molto vaga: non so se è un problema comune o se dipende dalle impostazioni della tesi. Leggendo in giro, molti consigliano di mettere mano ai file .el nei modi più fantasiosi, per questo ho postato qui. Io non ci capisco nulla…
Grazie per qualsiasi suggerimento!
PS uso emacs 23 su ubuntu.In generale non ho problemi a usare l’anteprima sull’ambiente equation, quindi il tuo problema potrebbe dipendere da un preambolo troppo complicato per Emacs (anche se senza conoscere il tuo preambolo è difficile stabilire quanto sia effettivamente complicato).
L’anteprima dei documenti LaTeX, comunque, è la funzione di AucTeX che, personalmente, ho usato di meno, per vedere il risultato di un documento preferisco compilarlo e vederlo per intero 😉
Comunque se hai ulteriore bisogno di aiuto per Emacs crea una nuova discussione, lo scopo di questa è raccogliere codice utile per gli altri, non fare domande (ti invito a fare ciò solo per mantenere ordine in questa discussione) 🙂
-
15 Febbraio 2011 alle 9:16 #51861::
Grazie, credo che tu abbia ragione sul preambolo. Trattandosi di una tesi, il file master contiene un sacco di roba all’inizio che forse auctex fa fatica a digerire. Per ora ho risolto scrivendo il tutto su un file vuoto e poi copiandolo alla fine nel file da includere nella tesi.
La preview per me è utilissima perché devo scrivere dei formuloni matematici parecchio complicati…
In effetti…scusate lo spam! (se volete cancellare il mio post non mi offendo)
Buona giornata.
-
16 Febbraio 2011 alle 11:17 #51862::
Riporto anche io il mio contributo. Queste sono le impostazioni nel fil .emacs in Ubuntu 10.10:
`; lunghezza righe
(setq-default fill-column 72)
; richiede file master
(setq-default TeX-master nil)
; interpretazione logica del sorgente
(setq TeX-parse-self t)
(setq TeX-auto-save t)
; blocca il log e permette di interagire alla presenza di errori
(setq TeX-interactive-mode t)
; Inserimento veloce matematica
(add-hook 'TeX-mode-hook 'LaTeX-math-mode)
; RefTeX
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(add-hook 'latex-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
; personalizzazione direttamente da emacs
(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-indent-environment-list (quote ((“verbatim” current-indentation) (“verbatim*” current-indentation) (“array”) (“displaymath”) (“eqnarray”) (“eqnarray*”) (“equation”) (“equation*”) (“picture”) (“tabbing”) (“table”) (“table*”) (“tabular”) (“tabular*”) (“description” current-indentation) (“itemize” current-indentation) (“lstlistings” current-indentation))))
'(TeX-PDF-mode t);compilazione con PDFLaTeX
'(TeX-command-list (quote ((“TeX” “%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t” TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help “Run plain TeX”) (“LaTeX” “%`%l%(mode)%' %t” TeX-run-interactive nil (latex-mode doctex-mode) :help “Run LaTeX”) (“Makeinfo” “makeinfo %t” TeX-run-interactive nil (texinfo-mode) :help “Run Makeinfo with Info output”) (“Makeinfo HTML” “makeinfo –html %t” TeX-run-compile nil (texinfo-mode) :help “Run Makeinfo with HTML output”) (“AmSTeX” “%(PDF)amstex %`%S%(PDFout)%(mode)%' %t” TeX-run-TeX nil (ams-tex-mode) :help “Run AMSTeX”) (“ConTeXt” “texexec –once –texutil %(execopts)%t” TeX-run-TeX nil (context-mode) :help “Run ConTeXt once”) (“ConTeXt Full” “texexec %(execopts)%t” TeX-run-TeX nil (context-mode) :help “Run ConTeXt until completion”) (“BibTeX” “bibtex %s” TeX-run-BibTeX nil t :help “Run BibTeX”) (“View” “%V” TeX-run-discard-or-function t t :help “Run Viewer”) (“Print” “%p” TeX-run-command t t :help “Print the file”) (“Queue” “%q” TeX-run-background nil t :help “View the printer queue” :visible TeX-queue-command) (“File” “%(o?)dvips %d -o %f ” TeX-run-command t t :help “Generate PostScript file”) (“Index” “makeindex %s” TeX-run-command nil t :help “Create index file”) (“Check” “lacheck %s” TeX-run-compile nil (latex-mode) :help “Check LaTeX file for correctness”) (“Spell” “(TeX-ispell-document \”\”)” TeX-run-function nil t :help “Spell-check the document”) (“Clean” “TeX-clean” TeX-run-function nil t :help “Delete generated intermediate files”) (“Clean All” “(TeX-clean t)” TeX-run-function nil t :help “Delete generated intermediate and output files”) (“Other” “” TeX-run-command t t :help “Run an arbitrary command”))))
'(TeX-debug-bad-boxes t);visualizza numero bad boxes
'(TeX-debug-warnings t);visualizza numero warnings
'(TeX-newline-function (quote newline-and-indent));indenta la nuova linea
'(TeX-show-compilation t)
'(TeX-source-correlate-method (quote synctex));ricerca diretta/inversa
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server t)
'(TeX-view-program-selection (quote (((output-dvi style-pstricks) “dvips and gv”) (output-dvi “xdvi”) (output-pdf “Evince”) (output-html “xdg-open”))))
'(compilation-ask-about-save t)
'(compilation-context-lines nil)
'(compilation-scroll-output (quote first-error))
'(preview-auto-cache-preamble t)
'(preview-inner-environments (quote (“Bmatrix” “Vmatrix” “aligned” “array” “bmatrix” “cases” “gathered” “matrix” “pmatrix” “smallmatrix” “split” “subarray” “vmatrix” “tabular”)))
'(reftex-label-alist (quote ((“lstlisting” 99 “cod:” nil nil (“codice”)) (“\\lstinputlisting[*]{}” 99 “cod:” nil nil (“codice”))))))
(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.
)`
EDIT: ecco anche le impostazioni per Aquamacs. Preferences.el
`;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.);;; direct/inverse search whit skim
;; Starts the Emacs server
(server-start)
;; Auto-raise Emacs on activation
(defun raise-emacs-on-aqua()
(shell-command “osascript -e 'tell application \”Emacs\” to activate' &”))
(add-hook 'server-switch-hook 'raise-emacs-on-aqua)
;; The following only works with AUCTeX loaded
(require 'tex-site)
(add-hook 'TeX-mode-hook
(lambda ()
(add-to-list 'TeX-output-view-style
'(“^pdf$” “.”
“/Applications/Skim.app/Contents/SharedSupport/displayline %n %o %b”)))
);;; Make emacs aware of multi-file projects
(setq-default TeX-master nil)
;;; Columns of 72 character width
(setq-default fill-column 72)
;;; Auto-save and logical interpretation
(setq TeX-parse-self t)
(setq TeX-auto-save t)
;;; Indentation level = 3
(custom-set-variables '(LaTeX-indent-level 3))
;;; Activate math-mode
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
;;; Spell check on startup
(add-hook 'TeX-mode-hook 'flyspell-mode)`
e customizations.el
`(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-command “latex”)
'(LaTeX-indent-level 3)
'(TeX-command-list (quote ((“TeX” “%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t” TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help “Run plain TeX”) (“LaTeX” “%`%l%(mode)%' %t” TeX-run-TeX nil (latex-mode doctex-mode) :help “Run LaTeX”) (“Makeinfo” “makeinfo %t” TeX-run-compile nil (texinfo-mode) :help “Run Makeinfo with Info output”) (“Makeinfo HTML” “makeinfo –html %t” TeX-run-compile nil (texinfo-mode) :help “Run Makeinfo with HTML output”) (“AmSTeX” “%(PDF)amstex %`%S%(PDFout)%(mode)%' %t” TeX-run-TeX nil (ams-tex-mode) :help “Run AMSTeX”) (“ConTeXt” “texexec –once –texutil %(execopts)%t” TeX-run-TeX nil (context-mode) :help “Run ConTeXt once”) (“ConTeXt Full” “texexec %(execopts)%t” TeX-run-TeX nil (context-mode) :help “Run ConTeXt until completion”) (“BibTeX” “bibtex %s” TeX-run-BibTeX nil t :help “Run BibTeX”) (“View” “%V” TeX-run-discard-or-function nil t :help “Run Viewer”) (“Print” “%p” TeX-run-command t t :help “Print the file”) (“Queue” “%q” TeX-run-background nil t :help “View the printer queue” :visible TeX-queue-command) (“File” “%(o?)dvips %d -o %f ” TeX-run-command t t :help “Generate PostScript file”) (“Index” “makeindex %s” TeX-run-command nil t :help “Create index file”) (“Check” “lacheck %s” TeX-run-compile nil (latex-mode) :help “Check LaTeX file for correctness”) (“Spell” “(TeX-ispell-document \”\”)” TeX-run-function nil t :help “Spell-check the document”) (“Clean” “TeX-clean” TeX-run-function nil t :help “Delete generated intermediate files”) (“Clean All” “(TeX-clean t)” TeX-run-function nil t :help “Delete generated intermediate and output files”) (“Other” “” TeX-run-command t t :help “Run an arbitrary command”) (“Jump to PDF” “%V” TeX-run-discard-or-function nil t :help “Run Viewer”))))
'(TeX-debug-warnings t)
'(TeX-newline-function (quote newline-and-indent))
'(TeX-view-program-selection (quote ((output-dvi “open”) (output-pdf-skim-running “Skim”) (output-pdf “Skim”) (output-html “open”))))
'(aquamacs-additional-fontsets nil t)
'(aquamacs-customization-version-id 210 t)
'(aquamacs-tool-bar-user-customization nil t)
'(ns-alternate-modifier nil)
'(ns-right-command-modifier (quote meta))
'(ns-tool-bar-display-mode (quote both) t)
'(ns-tool-bar-size-mode (quote regular) t)
'(visual-line-mode nil t))
(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.
'(latex-mode-default ((t (:inherit text-mode-default :stipple nil :strike-through nil :underline nil :slant normal :weight normal :height 130 :width normal :family “Monaco”))))
'(text-mode-default ((t (:inherit autoface-default :stipple nil :strike-through nil :underline nil :slant normal :weight normal :height 130 :width normal :family “Monaco”)))))
`
Le ultime righe servono per settare il font Monaco (monospaced) in modalità testo e latex. Spero di essere stato utile.
Ciao a tutti
Fra
-
8 Marzo 2011 alle 22:58 #51863::
Ho trovato questa minor mode per evidenziare le parentesi corrispondenti: http://centaur.maths.qmw.ac.uk/emacs/files/latex-paren.elEmacs è normalmente in grado di far corrispondere le parentesi chiuse a quelle aperte, ma con questa modalità ci sarà corrispondenza anche fra [tt]\[ [/tt] e [tt]\][/tt], [tt]\([/tt] e [tt]\)[/tt], [tt]\{[/tt] e [tt]\}[/tt] che altrimenti verrebbero riconosciute.
Riporto qui il file latex-paren.el perché su internet l’ho trovato solo sul sito sopra linkato e non vorrei che un giorno sparisca 😆
`;;; latex-paren.el — highlight matching LaTeX parens.;; F.J.Wright@Maths.QMW.ac.uk, 26 September 1998
;; For GNU Emacs 20 only
;; Based closely on paren.el by RMS
;; latex-paren.el is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.;; It is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.;;; Commentary:
;; Load this and it will improve show-paren-mode highlighting on
;; whatever paren matches the one before or after point in LaTeX mode.
;; It attempts to handle \(, \[, \{ and $ as well as (, [ and {.;; I suggest that you put this library somewhere in your `load-path'
;; and hang it on `latex-mode-hook' by putting this in `.emacs', so
;; that it is loaded only if necessary:;; (add-hook 'latex-mode-hook
;; (function (lambda () (require 'latex-paren))));;; Code:
;; General code to handle overloading of the standard show-paren-mode
;; to allow buffer-local handling of paren highlighting. (Done this
;; way to avoid modifying, and remain compatible with, paren.el.
;; Cannot just use a local hook, because it may be necessary to
;; REPLACE the standard function, which would be on the global hook,
;; and a local hook can only add to the global hook value.)(require 'paren)
(defvar show-paren-functions 'std-show-paren-function
“Function (or list of functions) to highlight matching parentheses etc.
The function(s) will be run automatically by a timer.
Give this variable buffer-local values to run custom functions.
Not to be changed by the casual user, hence not customizable!”)(fset 'std-show-paren-function (symbol-function 'show-paren-function))
(defun show-paren-function () (run-hooks 'show-paren-functions));; Specific code for LaTeX mode.
(let ((fn (function (lambda ()
(set (make-local-variable 'show-paren-functions)
'latex-show-paren-function)
))))
(add-hook 'latex-mode-hook fn)
(apply fn nil))(defun latex-show-paren-function ()
;; Do nothing if no window system to display results with.
;; Do nothing if executing keyboard macro.
;; Do nothing if input is pending.
(when window-system
(let (pos dir mismatch face (oldpos (point)) charquote)
(cond ((eq (char-syntax (preceding-char)) ?\))
(setq dir -1)
(setq charquote (uncharquote (char-after (- (point) 2)))))
((eq (char-syntax (following-char)) ?\()
(setq dir 1)
(setq charquote (uncharquote (preceding-char))))
((and (eq (char-syntax (preceding-char)) ?\$)
(not (eq (char-syntax (char-after (- (point) 2))) ?/)))
(setq dir -1))
((and (eq (char-syntax (following-char)) ?\$)
(not (eq (char-syntax (preceding-char)) ?/)))
(setq dir 1)))
;;
;; Find the other end of the sexp.
(when dir
(save-excursion
(save-restriction
;; Determine the range within which to look for a match.
(when blink-matching-paren-distance
(narrow-to-region
(max (point-min) (- (point) blink-matching-paren-distance))
(min (point-max) (+ (point) blink-matching-paren-distance))))
;; Scan across one sexp within that range.
;; Errors or nil mean there is a mismatch.
(condition-case ()
(setq pos (scan-sexps (point) dir))
(error (setq pos t mismatch t)))
;; If found a “matching” paren, see if it is the right
;; kind of paren to match the one we started at.
(when (integerp pos)
(let* ((beg (min pos oldpos)) (end (max pos oldpos))
(begchar (char-after beg)))
(setq mismatch
(not (eq (char-before end)
(if (eq (char-syntax begchar) ?\$) begchar
;; This can give nil.
(matching-paren begchar))))))))))
(if charquote (recharquote charquote))
;;
;; Highlight the other end of the sexp, or unhighlight if none.
(if (not pos)
(progn
;; If not at a paren that has a match,
;; turn off any previous paren highlighting.
(and show-paren-overlay (overlay-buffer show-paren-overlay)
(delete-overlay show-paren-overlay))
(and show-paren-overlay-1 (overlay-buffer show-paren-overlay-1)
(delete-overlay show-paren-overlay-1)))
;;
;; Use the correct face.
(if mismatch
(progn
(if show-paren-ring-bell-on-mismatch
(beep))
(setq face 'show-paren-mismatch-face))
(setq face 'show-paren-match-face))
;;
;; If matching backwards, highlight the closeparen
;; before point as well as its matching open.
;; If matching forward, and the openparen is unbalanced,
;; highlight the paren at point to indicate misbalance.
;; Otherwise, turn off any such highlighting.
(if (and (= dir 1) (integerp pos))
(when (and show-paren-overlay-1
(overlay-buffer show-paren-overlay-1))
(delete-overlay show-paren-overlay-1))
(let ((from (if (= dir 1)
(point)
(forward-point -1)))
(to (if (= dir 1)
(forward-point 1)
(point))))
(if show-paren-overlay-1
(move-overlay show-paren-overlay-1 from to (current-buffer))
(setq show-paren-overlay-1 (make-overlay from to)))
;; Always set the overlay face, since it varies.
(overlay-put show-paren-overlay-1 'face face)))
;;
;; Turn on highlighting for the matching paren, if found.
;; If it's an unmatched paren, turn off any such highlighting.
(unless (integerp pos)
(delete-overlay show-paren-overlay))
(let ((to (if (or (eq show-paren-style 'expression)
(and (eq show-paren-style 'mixed)
(not (pos-visible-in-window-p pos))))
(point)
pos))
(from (if (or (eq show-paren-style 'expression)
(and (eq show-paren-style 'mixed)
(not (pos-visible-in-window-p pos))))
pos
(save-excursion
(goto-char pos)
(forward-point (- dir))))))
(if show-paren-overlay
(move-overlay show-paren-overlay from to (current-buffer))
(setq show-paren-overlay (make-overlay from to))))
;;
;; Always set the overlay face, since it varies.
(overlay-put show-paren-overlay 'face face)))))(defun uncharquote (c)
(cond ((eq (char-syntax c) ?/)
(modify-syntax-entry c “.”) c)))(defun recharquote (c) (modify-syntax-entry c “/”))
(provide 'latex-paren)
;;; latex-paren.el ends here`
Come scritto nei commenti, per utilizzare questa modalità basta mettere il file in una cartella del load-path e aggiungere al file di inizializzazione
`(add-hook 'latex-mode-hook
(function (lambda () (require 'latex-paren))))`C’è scritto che funziona solo su Emacs 20 ma io ce l’ho su Emacs 23.2
EDIT. Mi devo correggere: forse se è attivo AUCTeX non funziona 🙁
-
-
AutoreRisposte
- Devi essere connesso per rispondere a questo topic.