Skip to Content.
Sympa Menu

texmacs-users - Re: Physics related symbols -- suggestions

Subject: mailing-list for TeXmacs Users

List archive

Re: Physics related symbols -- suggestions


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Re: Physics related symbols -- suggestions
  • Date: Mon, 14 Jan 2002 21:56:49 +0100

On Sunday 13 January 2002 21:26, address@hidden wrote:
> Hi all.
> I'm doing som physics work in TeXmacs and have run into some problems.
> My keyboard is swedish and I'm using Linux btw.
>
> (1) How do I type the ° (degree sybol, a small ring) in TeXmacs? (both
> math and regular mode). It's not on the usual key, and I can't find it
> anywhere else. In math mode you can kind of emulate this using ^o or
> something, is this how it's intended?

First, I want to point out that degree and superscripted o are different
symbols for different meaning. For example, a lot people write 1° (for
primo), while they should write 1^o.

You can get a degree symbol using \degreesign. That will only work in text
mode (see further on how to embed a text block in a math block).

> (2) How do I make a 'dagger' symbol in math mode? It's absolutley
> necessay when writing about quantum mechanics! If there's any way to
> type it I'd be very grateful for a reply. There is the 'creuz' symbol,
> which looks a bit like the dagger, but it'd be nice to have the real thing.

/dag, /ddag for double dagger. A-' or A-acute (assuming you have this key on
your keyboard) for superscripted dagger.

For you information, all keyboard bindings are defined in
/usr/share/TeXmacs-$VERSION/progs/keyboard/ (assuming you have installed
TeXmacs in /usr). A bit of grepping will always dig out the shortcut you are
looking for.

> (3) Is it possible to type an 'Å' (thats an A with a ring on top, used
> for the length unit Angstrom) in math mode without getting a red character?
> I assume this means that the character is not available in the math
> font, which is ok. However it'd be nice if it would become black when
> exporting to postscript.

You can get what you want using a text block nested in the math block.

You can create a nested text block using E-$ or the (badly named) "Insert
mathematics" toolbar menu while in math mode.

> From my physics point of view it'd be nice if all these symbols and
> the strikethrough h (\hbar) were available in the misc symbol menu. Is
> this too physic centered or would it be ok?

You can easily customize TeXmacs to suit your personal needs, provided
you have a basic knowledge of Scheme. I attached a sample TeXmacs
initialization script which adds \hbar and \dag to the misc symbols menu and
define shorthands.

Put this file in ~/.TeXmacs/progs, restart TeXmacs, enjoy.

This initialization file was made for TeXmacs-0.3.5.11, I have not tried to
use it with TeXmacs-0.3.5.8 (the latest stable version).

> I'd be thankful for any answer to my questions, especially on how to
> create the dagger.

You are welcome, this was my first attempt at TeXmacs user interface
customization. Would you not have asked this question, I would be more
ignorant today.
(exec-file "$TEXMACS_PATH/progs" "Init.scm")

;;; This part is utility functions
;;; Actually they should be part of TeXmacs, but at the moment, nothing is
;;; built-in to help customize the interface

(define (menu? l) (and (pair? l) (eq? (car l) '=>)))
(define (menu-get-icon menu) (cadr (cadr (cadr menu))))

(define (find-menu-by-icon menu-list icon)
(if (null? menu-list) () ; not found
(let ((m (car menu-list)))
(if (and (menu? m)
(equal? icon (menu-get-icon m))) ; look for menu
m ; found our menu, return
(find-menu-by-icon (cdr menu-list) icon))))) ; not found, recurse

(define (menu-insert menu item pos)
(let ((cell (list-tail menu (+ 1 pos))))
(set-cdr! cell (cons item (cdr cell)))))

;;;
;;; The actual user customization
;;;

(let ((m (find-menu-by-icon texmacs-math-icons "tm_miscsymb.xpm")))
(menu-insert m '(tile 8 (link physics-symbol-menu)) 0)
(menu-insert m '--- 1))

;; It seems TeXmacs does not handle successive motion commands
;; so this will not work as expected (it will end inside the text block)
(define (insert-text-angstrom)
(begin (make-with "mode" "text") (insert-string "Å") (go-right)))

;; Tooltips are only informational, the keyboard binding must be defined
;; elsewhere
(define physics-symbol-menu
'((symbol "<dag>" "i * - *")
;;("Å" "E-$ Å right" (insert-text-angstrom))
(symbol "<hbar>" "h * - *")))

(set-keymap (in-math?)
("h * - *" "<hbar>")
;;("Å" (insert-text-angstrom))
;;("E-O A" (insert-text-angstrom))
("i * - *" "<dag>"))



Archive powered by MHonArc 2.6.19.

Top of Page