[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] caption.el and geometry.el
From: |
Ralf Angeli |
Subject: |
Re: [AUCTeX-devel] caption.el and geometry.el |
Date: |
Thu, 03 Mar 2011 17:16:25 +0100 |
Please keep the mailing list copied!
* Mads Jensen (2011-02-26) writes:
> On 2011-02-23 20:36, Ralf Angeli wrote:
>> * Mads Jensen (2011-02-22) writes:
>>
>>> It's not a submission of those style-files (although the commands and
>>> key-val options have been retrieved from them), but more of a question
>>> for them. Both of these packages use the key-val assignment for both the
>>> options for \usepackage, and for a command (e.g., \captionsetup{}). I
>>> made a key-val variable for both style files, but it seems stupid to
>>> copy this variable and manually remove the second argument, if it's
>>> there).
>>
>> I don't understand what exactly you are referring to in the last
>> sentence. Can you provide an example?
>
> Please see the attached file for the geometry-package (which is almost
> complete except for the stuff I'm asking for). The package compiles, but
> I'd like to know how I can recycle the "LaTeX-geometry-key-val-options"
> as the package option also.
See comments below.
> Also, there is another thing to this, which is that the papersize-option
> is not the only way of defining the papersize; they can be written both as:
> papersize=a4paper, and a4paper (standalone). Is there a neat way to
> include the papersizes under TeX-add-symbols?
The geometry documentation on CTAN has this to say about the papersize
option:
| papersize width and height of the paper. papersize={⟨width⟩,⟨height⟩}
| or papersize=⟨length⟩.
So AFAIU paper names, such as a4paper, are not used together with the
papersize option anyway.
I also don't understand why you want to include the paper names in
`TeX-add-symbols'. `TeX-add-symbols' is for TeX macros, not for package
options. Or do you mean that you want to avoid defining a separate
variable. In that case you could let-bind it.
> ;;; geometry.el --- AUCTeX style for `geometry.sty'
>
> ;; Author: Mads Jensen <address@hidden
> ;; Created:
> ;; Keywords: tex
The blurb about the license is missing.
> ;;; Commentary:
>
> ;; This file adds support for `geometry.sty'.
>
> ;;; Code:
>
> ;; this should be used in both the "paper"-option, and they can also be
> ;; given as individual arguments to \usepackage
> (defconst papersizes (list '("a0paper" "a1paper" "a2paper" "a3paper"
The variable name should have a `LaTeX-geometry-' prefix.
> "a4paper" "a5paper" "a6paper" "b0paper"
> "b1paper" "b2paper" "b3paper" "b4paper"
> "b5paper" "b6paper" "ansiapaper"
> "ansibpaper" "ansicpaper"
> "ansidpaper" "ansiepaper" "letterpaper"
> "executivepaper" "legalpaper")))
>
> ;; had considered using this as the option to indicate that they take a
> ;; numeric argument rather than something else, e.g., a ratio
> (defconst TeX-units (list '("pt" "pc" "in"
This should also have a proper package-related prefix.
> "bp" "cm" "mm"
> "dd" "cc" "sp")))
>
> ;; FIXME surely there are better ways to do this than having a duplicate
> ;; of the same option twice
> ;; TODO include the section numbers to this mess
>
> (defvar LaTeX-geometry-key-val-options
> '(("papersize" papersizes)
See the comment regarding the papersize option above.
> ("paper" ("a0paper" "a1paper" "a2paper" "a3paper"
> "a4paper" "a5paper" "a6paper" "b0paper"
> "b1paper" "b2paper" "b3paper" "b4paper"
> "b5paper" "b6paper" "ansiapaper"
> "ansibpaper" "ansicpaper"
> "ansidpaper" "ansiepaper" "letterpaper"
> "executivepaper" "legalpaper"))
Perhaps you could reuse the `papersizes' variable here. I'm not sure if
you can simply use the variable or if you have to expand it with a
backquote/comma construct, see (info "(elisp)Backquote"). You'd also
have to make sure that the list depth is correct for the use here.
> ("screen")
> ("paperwidth")
[...]
> ("showframe")
> ("compat2"))
> "Key=value options for geometry command and options to use in th
> usepackage-command.")
This line is too long, see (info "(elisp)Documentation Tips").
> (TeX-add-style-hook
> "geometry"
> (lambda ()
> (TeX-add-symbols '("geometry" (TeX-arg-key-val
> LaTeX-geometry-key-val-options)))
This line is too long. The limit is usually 80 characters.
> ;; Fontification
> (when (and (featurep 'font-latex)
> (eq TeX-install-font-lock 'font-latex-setup))
> ;; Tell font-lock about the update.
> (font-latex-add-keywords '("geometry" "{") 'function)
> (setq font-lock-set-defaults nil)
> (font-lock-set-defaults))))
>
> ;; there weren't any mentioned in the manual; I might have missed them
> (defvar LaTeX-geometry-package-options LaTeX-geometry-key-val-options
> "Package options for the geometry package.")
So, back to your original question. AFAICS there is no support for the
insertion of key=value options in `LaTeX-arg-usepackage'. (I think this
is also true for the \documentclass options.) Something like this would
have to be added before you can reuse your key-val variable here.
> ;;; geometry.el ends here
As a side note, there is a lot of trailing whitespace in the file. You
can make this visible by setting `show-trailing-whitespace' to t and
remove all trailing whitespace with `M-x delete-trailing-whitespace
<RET>'.
--
Ralf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [AUCTeX-devel] caption.el and geometry.el,
Ralf Angeli <=