<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Antoine,<br>
<br>
Le 28/08/2016 09:46, Antoine Monmayrant a écrit :<br>
</div>
<blockquote cite="mid:4390-57c29700-f-92f22b0@135284177" type="cite">
<pre wrap="">Le Samedi, Août 27, 2016 19:24 CEST, philippe <a class="moz-txt-link-rfc2396E" href="mailto:rouxph.22@gmail.com"><rouxph.22@gmail.com></a> a écrit:
../..
Thanks Philippe, but nope, it does not work that easily.
It does for "\alpha", but my real use case is a bit more complicated and calling titlepage directly is a mess.
I use titlepage(errormessage) where errormessage is a string array with a lot of starting and trailing " " (white spaces).
I need to preserve these white spaces and use a monospace font to preserve the relative alignment between the different lines in the array.
Doing this is a bit convolved when using titlepage alone:
- add some character at the begining of each line (to prevent titlepage from stripping the white spaces),
- call titlepage,
- get a handle the the create textbox,
- change text justification (middle->lef centered)
- change font style (0 for monospace).
This is what I use now, but titlepage("$\verb| error message |$") would have been more compact and elegant.</pre>
</blockquote>
.<br>
I definitely agree on the fact that xstring() (and xstringb(),
called by titlepage(), <br>
and that are the guilty guys) always trimming all leading spaces is
an issue.<br>
<br>
It should be the user's responsability to use stripblanks() whenever
it is required<br>
before feeding xstring(), and that xstring() does not always do that
in an<br>
irreversible way (text stored in xstring.text is actually
deblanked).<br>
<br>
<font color="#009900">Presently, the text.alignment property can be
either "left", "center" and "right",<br>
the default being "left".<br>
IMO, a new <b>"as_is"</b> or <b>"none"</b> value should be
added, and even become the default.<br>
</font><br>
For the time being, you may test and use the attached version of
titlepage:<br>
As soon as at least one of the strings has a leading space, the
whole matrix<br>
of strings is displayed "as is", in order to preserve any
indentations and so.<br>
To do so, strings are displayed in LaTeX mode. Run<br>
<tt>--> head_comments titlepage // to get details, or see the
header in the script.</tt><tt><br>
</tt><br>
This workaround has 2 drawbacks:<br>
* lines are more compact (IMO too compact). I did not find any way
to tune this in supported LaTeX.<br>
* The font style must be set when calling titlepage(). It can't be
changed with text.font_style,<br>
and must be chosen when calling titlepage(). And only 3 fonts
are available.<br>
But the text.font_foreground attribute works!<br>
<br>
Example:<br>
<tt>t = ["Here are indented nested lists"</tt><tt><br>
</tt><tt>" a) First point"</tt><tt><br>
</tt><tt>" * First item"</tt><tt><br>
</tt><tt>" * Second item"</tt><tt><br>
</tt><tt>" b) Another view"</tt><tt><br>
</tt><tt>" c) For a new titlepage()?"</tt><tt><br>
</tt><tt>]</tt><tt><br>
</tt><tt>clf</tt><tt><br>
</tt><tt>subplot(2,2,1)</tt><tt><br>
</tt><tt>titlepage(t)</tt><tt><br>
</tt><tt>xtitle("Default titlepage(t)")</tt><tt><br>
</tt><tt>subplot(2,2,2)</tt><tt><br>
</tt><tt>// exec() the new titlepage.sci</tt><tt><br>
</tt><tt>titlepage(t)</tt><tt><br>
</tt><tt>subplot(2,2,3)</tt><tt><br>
</tt><tt>titlepage([t ; "" ; t])</tt><tt><br>
</tt><tt>head_comments titlepage<br>
subplot(2,2,4)</tt><tt><br>
</tt><tt>titlepage(t,0)</tt><tt><br>
</tt><tt>e = gce();</tt><tt><br>
</tt><tt>e.font_foreground = color("blue");</tt><tt><br>
clear titlepage // comes back to the default titlepage()<br>
</tt><br>
<b>Results</b>:<br>
<img src="cid:part1.08070303.06020404@free.fr" alt="" height="347"
width="450"><br>
<br>
This can be proposed as is to upgrade the present titlepage(),<br>
even if it would be better to implement ASAP an "as_is" value for
xstring.alignment.<br>
<br>
Cheers<br>
Samuel<br>
<br>
</body>
</html>