Bug 187438 - user defined symbol table cannot include UTF8 characters
Summary: user defined symbol table cannot include UTF8 characters
Status: RESOLVED FIXED
Alias: None
Product: kile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-17 20:52 UTC by Yossi Gil
Modified: 2009-05-09 15:34 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
A sample file generated for the user symbols (283 bytes, image/png)
2009-03-18 09:48 UTC, Yossi Gil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yossi Gil 2009-03-17 20:52:47 UTC
Version:           2.03 (using KDE 4.0.5)
OS:                Linux
Installed from:    Compiled From Sources

Using 

\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}

I can type a unicode character in UTF8, instead of a LaTeX macro.
For example, I can write in LaTeX a sentence such as 
"For a  string~$α∈Σ$..." instead of the usual "For a  string~$\alpha \in \Sigma$..."
Now, I follow the instructions for producing a user defined symbols list. I do get a view of the symbols, but they are not inserted properly when I click on them.

My symbols.tex reads:

\documentclass[10pt]{article}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[fleqn]{amsmath}

\input{definitions}
\begin{document}
\mathcommand[≠]{≠}
\mathcommand{≤}
\mathcommand{≥}
\mathcommand{∈}
\mathcommand{∉}
\mathcommand{∪}
\mathcommand{⊆}
\mathcommand{⊇}
\mathcommand{⊃}
\mathcommand{⊃}
\mathcommand{∖}
\mathcommand{∅}
\mathcommand{∖}
\mathcommand{∀}
\mathcommand{∃}
\mathcommand{α}
\mathcommand{β}
\mathcommand{γ}
\mathcommand{ε}


\mathcommand{⊃}


\end{document}
Comment 1 Thomas Braun 2009-03-18 08:36:56 UTC
Hi,

could you give an example what gets inserted instead?
And can you attach one of the in this way generated pngs?

thanks,
thomas
Comment 2 Yossi Gil 2009-03-18 09:30:16 UTC
Well, what gets inserted is a simple "?", that is a single question mark.
Comment 3 Yossi Gil 2009-03-18 09:48:22 UTC
Created attachment 32229 [details]
A sample file generated for the user symbols
Comment 4 Thomas Braun 2009-03-18 19:58:18 UTC
Okay, there are two things to mention here.
The easy part is that the coded for the input stream in gesymb.cpp has to be set to e. g. UTF-8.

The tricky part is [ taken from http://www.libpng.org/pub/png/spec/1.1/PNG-Chunks.html#C.tEXt]:
Both keyword and text are interpreted according to the ISO/IEC 8859-1 (Latin-1) character set [ISO/IEC-8859-1]. The text string can contain any Latin-1 character. Newlines in the text string should be represented by a single linefeed character (decimal 10); use of other control characters in the text is discouraged. 

So we have to find a way to hack around this limitation.
Comment 5 Yossi Gil 2009-03-19 05:57:23 UTC
Here is what can be done.
Each PNG file could have another key, pair value, in the form

  <UNICODE-ALTERNATE: U+03B1>

If the pair is present, and the user enabled a newly introduced UNICODE mode, clicking on
the icon, would insert the single Unicode alternative. This should apply to all symbols, not
just user defined.
Comment 6 Yossi Gil 2009-03-28 19:37:00 UTC
I figured out that the changed should be in 
void SymbolView::fillWidget(const QString& prefix) ...
to change the following line somehow:

item->setKey( refCnts[i] + '%' + image.text("Command") + '%' + image.text("Packages") + '%' + paths[i]  ;

Is this correct?
Why do you save the path here?
Comment 7 Thomas Braun 2009-03-29 15:02:16 UTC
Hi,

I started looking into it. Using the integer number for the unicode symbol is a good idea. I'll also started to adapt gesymb.
The code line in symbolView::fillWidget you cite is correct. The path is saved for the "most recently used" list of symbols.
Comment 8 Thomas Braun 2009-05-09 15:34:02 UTC
SVN commit 965595 by tbraun:

new file format for generating png symbols and UTF-8 support

The xml format is defined by the example file draft-version-symbolFormat.xml.
These files can be read by gesymb-ng and create png files like gesymb.

Some new things are possible with gesymb-ng:
- UTF-8 characters instead of commands can be inserted. Especially useful for symbols like \neq.
  This can be set global in kile.
- A list of packages which are needed for UTF-8 symbols are defined on a per file basis. This differs from
  latex commands where each can have different depending packages. This might change in the future if needed.
- A comment string (UTF-8 encoded including HTML Markup) can be added to the png and this will be displayed as part of the tooltip.

BUG: 187438
BUG: 175551

To try gesymb-ng do the following:

- svn up
- cd <kile-build-directory>/src/data/symbols-ng
- make gesymb-ng
- ./gesymb-ng <kile-src-path>/src/data/draft-version-symbolFormat.xml
- mkdir ~/.kde/share/apps/kile/mathsymbols/user (maybe the path to your kde dot directory is .kde4)
- cp img002math.png ~/.kde/share/apps/kile/mathsymbols/user
- restart kile
- Hover your mouse over this user defined symbol
- Enjoy!

WebSVN link: http://websvn.kde.org/?view=rev&revision=965595