| 
      
      
      From: Yury <yur...@gm...> - 2024-05-19 04:07:46
       | 
| Hi all,
Just seen Tex-outputting terminals mentioned.
I've been testing those recently (although not 
extensively), and there are some issues with 
those, primarily w/r to sizes representation and 
fonts specification.
Plot dimensions (at least on screen) are 
rendered as specified. So are lines *lengths*.
Lines *widths* (at least on screen) are about 
25% of specified values in `cairolatex` and 
`epslatex`, and about 50% of specified values in 
`lua+tikz+latex`.
Font *sizes* in `set label`s are rendered 
correctly in `lua+tikz+latex` and incorrectly, 
as latex compiler's default, in `cairolatex` and 
`epslatex` in such labels in which font sizes 
are set with ` font ",24"` sort of clauses.
Font *faces* specification in the 'modern' latex 
compilers style ('use any font installed in the 
system') works only...
* in `lua+tikz+latex` -- if the following 
'trick' is used in font specification:
` font "\\fontspec{Times New Roman}" `
* in `epslatex` and `cairolatex` -- if 
`\usepackage{fontspec}` is added to the Tex 
output preamble and the fragment is deleted from 
the preamble, referencing '.clo' files and 
sitting between `\makeatletter` and 
`\makeatother` (including both).
Tics labels *faces* are generally rendered 
incorrectly (?), i.e. in TeX default math face 
(so, ignoring user setting in `set term`), 
because tics labels texts are transformed to 
formulas in TeX output ($0$, $1$ etc.).
I've peeked into sources but got lost quickly. 
I've got the idea, though, that there is a lot 
of empirical adjusting in terminals outputting 
scalable graphics (both tex and postscript/pdf 
ones). Was I right?
I'm using XeTeX in TexLive package and gnuplot 
`6.0 patchlevel 0` on Linux.
 | 
| 
      
      
      From: Ethan M. <eam...@gm...> - 2024-05-19 07:03:54
       | 
| On Saturday, 18 May 2024 21:07:37 PDT Yury wrote:
> Hi all,
> 
> Just seen Tex-outputting terminals mentioned.
> 
> I've been testing those recently (although not 
> extensively), and there are some issues with 
> those, primarily w/r to sizes representation and 
> fonts specification.
First some background.
With the exception of the lua/tikz terminal, gnuplot's TeX output
creates two separate output streams, one stream for the text elements
(to be processed by a TeX engine like pdflatex) and one stream 
for everything else. The fine details of the 'everything else' stream
depend on the associated graphics terminal.
The cairolatex terminal uses cairo graphics, the epslatex terminal
uses Encapsulated PostScript, and so on. 
Most (all?) gnuplot terminals accept scale factors for line width,
point size, and font size as part of the "set terminal" command.
The defaults were chosen years ago to be approximately consistent
across terminals.   Those defaults may not have aged well.
For example if you select the cairolatex terminal
with pdf graphics, gnuplot will echo back the default settings:
   gnuplot> set term cairolatex pdf
   Terminal type is now 'cairolatex'
   Options are ' pdf input noheader blacktext nobackground noenhanced fontscale 0.6 size 5.00in, 3.00in '
That tells you the nominal font sizes will be scaled by a factor of 0.6.
The default pointsize and linewidth scales are 1.0 but that leaves open exactly
what the base size is in absolute terms.  The gnuplot documentation for
cairo + pdf output states
  "The width of all lines in the plot can be modified by the factor <lw>
   specified in linewidth. The default linewidth is 0.5 points.
   (1 "PostScript" point = 1/72 inch = 0.353 mm)"
Take that with a grain of salt.
If you are unhappy with the default settings, you can change them when
you select the terminal.
   gnuplot> set term cairolatex pdf linewidth 2.0 pointscale 2.0 fontscale 1.0
   Terminal type is now 'cairolatex'
   Options are ' pdf input noheader blacktext nobackground noenhanced fontscale 1.0 size 5.00in, 3.00in  linewidth 2 pointscale 2'
Note that these scale factors that you give as part of the terminal setting
are applied *on top of* any global gnuplot commands like "set pointsize"
and also any linewidth, pointsize settings in the plot commands.
> Lines *widths* (at least on screen) are about 
> 25% of specified values in `cairolatex` and 
> `epslatex`, and about 50% of specified values in 
> `lua+tikz+latex`.
See above. According to the documentation the default linewidth is 0.5 points
but it could well be that the cairo terminals deviate from this.
> Font *sizes* in `set label`s are rendered 
> correctly in `lua+tikz+latex` and incorrectly, 
> as latex compiler's default, in `cairolatex` and 
> `epslatex` in such labels in which font sizes 
> are set with ` font ",24"` sort of clauses.
Gnuplot's assumption is that if you select a TeX-based terminal
that the text processing, including font properties, will be set
in the surrounding TeX document.  The nominal font size you
tell gnuplot is used only to estimate the space that will be
occupied by that text element when TeX renders it, and if there
is any markup that estimate can be pretty awful.
The TeX-based terminals ignore gnuplot's own "enhanced text"
mode, again assuming that any markup syntax will be interpreted
by the TeX engine.
There is also an extremely minimal set of examples of using gnuplot's
latex terminals here.
    http://www.gnuplot.info/docs/latex_demo.pdf
I quite agree it would be very nice if someone were to expand
that with a discussion of how to pass font information through
to pdflatex (or lualatex etc).
> Tics labels *faces* are generally rendered 
> incorrectly (?), i.e. in TeX default math face 
> (so, ignoring user setting in `set term`), 
> because tics labels texts are transformed to 
> formulas in TeX output ($0$, $1$ etc.).
I don't understand what exactly you mean here.
You can set the tic format to whatever you want.
The default format for latex terminal output is "$%h$",
which seems reasonable.  You could change that to, say,
    set xtics format '{\small \bf category %.2g}'
if that is appropriate to your plot.
Does that help?
    Ethan
> 
> I've peeked into sources but got lost quickly. 
> I've got the idea, though, that there is a lot 
> of empirical adjusting in terminals outputting 
> scalable graphics (both tex and postscript/pdf 
> ones). Was I right?
> 
> I'm using XeTeX in TexLive package and gnuplot 
> `6.0 patchlevel 0` on Linux.
 | 
| 
      
      
      From: Yury <yur...@gm...> - 2024-05-19 13:59:10
       | 
| On 19/05/2024 10:03, Ethan Merritt wrote: > First some background. My thanks and my apologies. I sincerely appreciate that exposition, but I should've been more specific, too, it seems. I knew about multiplication factors and when testing, I've set all of those to 1.0, and I've expressed all sizes (as appropriate) in metric units. E.g. line width 50mm as 72.0/25.4*50. Then I've output the resulting PS and/or PDF to screen and measured things with a ruler. Also checked in the resulting PS and uncompressed PDF to see sizes of things as expressed in points, however much of that I could understand. > If you are unhappy with the default settings, you can change them when > you select the terminal. Thing is, all scalable terminals seem to do their own thing with sizes. With `postscript+eps` we at least know something *determinate* in advance. With other ones, nope. Posting this, I'm sort of hoping developers would give the matter a look, if possible. Undocumented behaviour > You can set the tic format to whatever you want. > The default format for latex terminal output is "$%h$", Somehow I've imagined that format to be hardcoded in tex terminals. Nice. > Does that help? Thank you. Also, see the 1st paragraph of this reply. Thank you, regardless. -Yury |