octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fltk printing [latex output]


From: Michael D Godfrey
Subject: Re: fltk printing [latex output]
Date: Mon, 09 Aug 2010 12:29:30 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Thunderbird/3.1.1

On 08/09/2010 09:12 AM, bpabbott wrote:
On 09 Aug, 2010,at 10:19 AM, bpabbott <address@hidden> wrote:

On 08 Aug, 2010,at 04:12 PM, Ben Abbott <address@hidden> wrote:

On Aug 8, 2010, at 4:04 PM, Michael D Godfrey wrote:

> On 08/08/2010 12:29 PM, Ben Abbott wrote:
>> The fltk backend now supports printing using the epslatex, pslatex, pdflatex devices (pdflatex is not yet documented, but it works the same as epslatex and pslatex).
>>
>> There is one minor problem. The alignment of rotated text is not handled correctly. I thought it best to mention it ... and hope a latex fan would take a look at what needs to be done to the gl2ps.c code to fix it.
>>
>> For example ..
>>
>> close all
>> backend fltk
>> plot (0:10)
>> xlabel ("xlabel")
>> ylabel ("ylabel")
>> print -depslatexstandalone test
>>
>> Then run latex of test.tex. In the resulting testdvi (or test.ps or test.pdf depending upon your setup) the ylabel is rotated correctly, but is not aligned correctly.
>>
>> PGF output is also available.
>>
>> print -dtikz test.pgf
>>
>> Thus far I'm not yet able to get the PGF to work. However, I'm not confident I'm using the pgf file correctly.
>>
>> Ben
>>
> Ben,
>
> I gave this a try with:
> 1015 # Octave 3.3.52+, Sun Aug 08 08:25:52 2010 PDT <address@hidden>
> 1016 plot(1:20)
> 1017 xlabel(' x label ')
> 1018 ylabel(' y label ')
> 1019 title('title')
> 1020 text(10,10,'centered')
> 1021 text(10,15,' math $\omega\gamma$ end ')
> 1022 print -depslatexstandalone test
> 1023 quit
> ========================================
> With just a bit of post-processing this produced (using pdflatex test) the attached.
> This looks GREAT to me.
>
> Michael

Notice your "ylabel" is not centered correctly. The middle of the string should be aligned to the tickmark for 10.

Looking at the latex file, the problem is with ...

\selectfont\put(39.8755,224.56){\makebox(0,0)[b]{\rotatebox{90}{\textcolor[rgb]{0,0,0}{{ylabel}}}}}

Which should be ...

\selectfont\put(39.8755,224.56){\makebox(0,0)[c]{\rotatebox{90}{\textcolor[rgb]{0,0,0}{{ylabel}}}}}

Ben
 
I played with the latex a bit more. My impression as to what needed to be done to fix the alignment was wrong. The text is aligned by GL2PS's LaTeX implementation *after* the rotation. Which is opposite of what is done for Octave / Matlab.

Thus, for the ylabel text object; verticalalignment = bottom, horizontalalignment = center, and rotation = 90, the position should be [cr].

I don't see am easy way to handle text alignment and arbitrary rotation. Is there a latex approach to placing the text that is better suited? If not we can modify the sources to properly handle rotations in increments of 90 deg, and select the best representation for the rest.

Ben

p.s. Michael/Shai, I sent you a similar email earlier, and then decided it best to copy the list.
 
I need to do some further testing, but when I transposed the makebox with the rotation ...

    \selectfont\put(39.8755,224.56){\rotatebox{90}{\makebox(0,0)[b]{\textcolor[rgb]{0,0,0}{{ylabel}}}}}

... the text is aligned correct.

This should be a fairly easy patch to make to GL2PS.

Ben




A few points about this:

1. It seems to me to make more sense to do the rotate and then the \makebox in any case.
2. Officially LaTeX \makebox only provides position arguments l,r,c.  But, I have seen other
    arguments used before.
3. What happens in your example above if you just change "b" to "c"?
4. It  might be good to convince the OpenGL folks to switch to the rotate then makebox order.
    And, use the position argument that works best.

Michael


reply via email to

[Prev in Thread] Current Thread [Next in Thread]