auctex-devel
[Top][All Lists]

## [AUCTeX-devel] Re: [AUCTeX] Generating symbols with preview-latex

 From: David Kastrup Subject: [AUCTeX-devel] Re: [AUCTeX] Generating symbols with preview-latex Date: Fri, 28 Jul 2006 17:01:54 +0200 User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Miguel V. S. Frasson" <address@hidden> writes:

> I will put this post back in auctex-devel.
>
> On 7/28/06, David Kastrup <address@hidden> wrote:
>> "Miguel V. S. Frasson" <address@hidden> writes:
>>
>> > The situation is the following: I want to eventually implement a
>> > symbol toolbar without having to generate symbols by myself. In the
>> > current stage, I am happy if my symbol toolbar has only the \alpha and
>> > \beta symbols.
>> >
>> > I want
>> >
>> > 1) code to *request* the producion of a image object with the symbol
>> > \alpha (using preview latex), without editing a LaTeX file preferably.
>> > (if really necessary, fake such editing in a temp buffer).
>> >
>> > 2) code that tests if that the image is ready or not (predicate) and
>> > code that runs (hook) when the image object (or set of image objects)
>> > is ready.  The later can do the work of the former, because the hook
>> > can set some variable and set the predicate.
>> >
>> > 3) a way to store it in some lasting cache, so that I don't have to
>> > regenerate it every time that I restart Emacs.
>>
>> I don't see why you would not want to pregenerate all the symbols.  I
>> don't see any need to use Emacs in an interactive session for that.
>
> Symbols with white background and black font colors don't look nice
> (IMO) in the toolbar.  Different displays may request different
> resolutions.

Since when?  Toolbar buttons have a fixed size in Emacs, and also in
XEmacs.  And you need not use a white background if you don't want to.

You can work with \colorbox and \fcolorbox and \textcolor also in
LaTeX.

> For myself, not only for AUCTeX users, I like that symbols in my
> symbol toolbar have the same background color that I have in the
> toolbar.  I have not yet got such symbols, but a priori there is
> nothing wrong on wanting that.

That would seem possible using transparent color.

> How many sets of icons do we have to ship?
>
> We can distribute a basic set anyway.
>
>> [later you say] I don't see why you would need Emacs for that.
>
> Emacs should know the colors of toolbars. One can customize Emacs to
> generate largers, darkers images, use custom colors for the symbols,
> whatever.

I don't think that on-line customization from Emacs is a useful goal.
If such parameters are desired, a batch procedure can be delivered
that creates all wanted icons with the designed parameters.  But no
other toolbar icons do this.

> Of course you can disagree with all this. Please tell me that this
> is not what should happen and I just don't implement it. It is
> simple.
>
>> > Is this possible?
>>
>> Is there some problem with
>> \documentclass[minimal]
>> \usepackage[active,tightpage,textmath]{preview}
>> \begin{document}
>> $\alpha$
>> $\beta$
>> $\gamma$
>> $delta$
>> \end{document}
>>
>> then running dvipng on the resulting DVI file?
>
> I though that it was harder to do that.  I didn' t know that it was
> easy (although the defauls are far from the best).  I thought that
> preview-latex was necessary.

The preview package does the work.  You can, if you want to, do
something like

\documentclass[minimal]
\usepackage{color}
\usepackage[active,tightpage]{preview}
\newcommand\mathicon[1]{\fcolorbox ...}
\PreviewMacro\mathicon[!]
\begin{document}
\mathicon{\alpha}
\mathicon{\beta}
...
\end{document}

>> > When user requests for instance th lowercase greek symbols, a
>> > process is started and in the toolbar he would see that under
>> > construction'' icon, like when using preview latex in a normal
>> > LaTeX file.  When a symbol or set of symbols is finished, there
>> > is a refresh of the toolbar and the buttons with the generated
>> > images are displayed.  That is the idea.
>>
>> Why wouldn't you generate them once in advance and _distribute_ the
>> generated image buttons?

I still think that the basic procedure of creating buttons should not
involve something as complicated as preview-latex, but rather be done
in a batch manner.  Toolbar creations are customization work, and is
see no sane reason why that has to happen in background.  You don't
want to continue editing, have toolbar buttons appear later that you
find look ugly, and then start over again.  Updating a buffer in the
background is sensible, but the toolbar?

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum