Title in the Stats Box will not adjust to the given size in the .tex output

I want to embed a root graphic in a Latex file and got the following problem:
The Size of the titles in the Statistic Boxes adjust to the given size in the PDF and the normal root output but it will not adjust in the .tex file. In the Latex dokument, the size of the titles are the original size.

Here are my dokuments:
original_fast.c (11.0 KB)
Penalty_1000_522000.txt (1.3 MB)
Penalty_8000_522000_new.txt (1.3 MB)
Penalty_4000_522000.txt (1.3 MB)
Penalty_Chr_3.5_522000.txt (1.3 MB)
Penalty_100_522000.txt (1.3 MB)
Penalty_2000_522000.txt (1.3 MB)

Here are the Latex Files
Latex.zip (4.9 KB)

A workaround… you can do search+replace on your Stats.tex file and change
scale=0.765852
with whatever scale factor you prefer.

I tried to run your macro. I get:

Processing original_fast.c...
In file included from input_line_11:1:
/Users/couet/Downloads/original_fast.c:204:8: error: redefinition of 'lol'
TList *lol = s->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:176:8: note: previous definition is here
TList *lol = s5->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:205:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value));
        ^
/Users/couet/Downloads/original_fast.c:177:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value5));
        ^
/Users/couet/Downloads/original_fast.c:232:8: error: redefinition of 'lol'
TList *lol = s1->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:176:8: note: previous definition is here
TList *lol = s5->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:233:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value1));
        ^
/Users/couet/Downloads/original_fast.c:177:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value5));
        ^
/Users/couet/Downloads/original_fast.c:260:8: error: redefinition of 'lol'
TList *lol = s2->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:176:8: note: previous definition is here
TList *lol = s5->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:261:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value2));
        ^
/Users/couet/Downloads/original_fast.c:177:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value5));
        ^
/Users/couet/Downloads/original_fast.c:288:8: error: redefinition of 'lol'
TList *lol = s3->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:176:8: note: previous definition is here
TList *lol = s5->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:289:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value3));
        ^
/Users/couet/Downloads/original_fast.c:177:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value5));
        ^
/Users/couet/Downloads/original_fast.c:316:8: error: redefinition of 'lol'
TList *lol = s4->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:176:8: note: previous definition is here
TList *lol = s5->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:317:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value4));
        ^
/Users/couet/Downloads/original_fast.c:177:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value5));

Hi couet, now your error should be resolved.
Try this version original_fast.c (10.9 KB)

Yes i see that the template.tex file produces a distorted output for both 2D_35_fast.tex and 2D_35_fast.pdf . Note that 2D_35_fast.pdf is correct when visualized alone. I made a template2.tex file based on the example given in the documentation (see the code at the end of this post). And then the output produced from this file is correct. So something else in the file template.tex file should distord the image.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\title{A simple LaTeX example}
\date{March 2018}
\begin{document}
\maketitle
The following image as been generated using the TTeXDump class:
\par
\resizebox{0.98 \width}{18cm}{\input{2D_35_fast.tex}}
\end{document}

It seems the faulty line is:

\documentclass[a0,portrait]{a0poster}

If I replace it with:

\documentclass{article}

Then the image is not distorted .

This is very unfortunate, because I cannot produce a poster with the article class. But I found the problem:
As soon as you do not add any extra lines in the status box, then the titles are visualized in the correct size.
Here you can see the difference:

original_fast.c (11.1 KB)

Does anybody know the reason for that?

No … but I can check. That’s really bizarre because both the tex and the pdf show this effect when included in a tex file. The pdf seems ok when visualised alone …

Again your code is not C++:

root [0] 
Processing original_fast.c...
In file included from input_line_11:1:
/Users/couet/Downloads/original_fast.c:288:8: error: redefinition of 'lol'
TList *lol = s3->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:260:8: note: previous definition is here
TList *lol = s2->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:289:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value3));
        ^
/Users/couet/Downloads/original_fast.c:261:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value2));
        ^
/Users/couet/Downloads/original_fast.c:316:8: error: redefinition of 'lol'
TList *lol = s4->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:260:8: note: previous definition is here
TList *lol = s2->GetListOfLines();
       ^
/Users/couet/Downloads/original_fast.c:317:9: error: redefinition of 'ltx'
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value4));
        ^
/Users/couet/Downloads/original_fast.c:261:9: note: previous definition is here
TLatex *ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value2));

Sry my compiler does not care if objects are defined twice. Here is the correct version.
original_fast.c (11.1 KB)

It seems your compiler does not also care of undeclared variables (which is weird …):

In file included from input_line_11:1:
/Users/couet/Downloads/original_fast.c:260:1: error: use of undeclared identifier 'lol'
lol = s2->GetListOfLines();
^
/Users/couet/Downloads/original_fast.c:261:1: error: use of undeclared identifier 'ltx'
ltx = new TLatex(0, 0, TString::Format("f(x_0) = %g", ref_value2));
^
/Users/couet/Downloads/original_fast.c:262:1: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
^
/Users/couet/Downloads/original_fast.c:262:23: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                      ^
/Users/couet/Downloads/original_fast.c:262:56: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                                                       ^
/Users/couet/Downloads/original_fast.c:263:1: error: use of undeclared identifier 'lol'
lol->Add(ltx);
^
/Users/couet/Downloads/original_fast.c:263:10: error: use of undeclared identifier 'ltx'
lol->Add(ltx);
         ^
/Users/couet/Downloads/original_fast.c:264:1: error: use of undeclared identifier 'ltx'
ltx = new TLatex(0, 0, TString::Format("1%% = %g", value));
^
/Users/couet/Downloads/original_fast.c:265:1: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
^
/Users/couet/Downloads/original_fast.c:265:23: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                      ^
/Users/couet/Downloads/original_fast.c:265:56: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                                                       ^
/Users/couet/Downloads/original_fast.c:266:1: error: use of undeclared identifier 'lol'
lol->Add(ltx);
^
/Users/couet/Downloads/original_fast.c:266:10: error: use of undeclared identifier 'ltx'
lol->Add(ltx);
         ^
/Users/couet/Downloads/original_fast.c:267:1: error: use of undeclared identifier 'ltx'
ltx = new TLatex(0, 0, TString::Format("2%% = %g", value));
^
/Users/couet/Downloads/original_fast.c:268:1: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
^
/Users/couet/Downloads/original_fast.c:268:23: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                      ^
/Users/couet/Downloads/original_fast.c:268:56: error: use of undeclared identifier 'ltx'
ltx->SetTextFont(42); ltx->SetTextSize(StatsTextSize); ltx->SetTextColor(1);
                                                       ^
/Users/couet/Downloads/original_fast.c:269:1: error: use of undeclared identifier 'lol'
lol->Add(ltx);
^
/Users/couet/Downloads/original_fast.c:269:10: error: use of undeclared identifier 'ltx'
lol->Add(ltx);
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

No this time I deleted all of them. Now it works.
original_fast.c (11.1 KB)

I found out that if you include the pdf file then the image is not distorted.

\usepackage{pdfpages}

....

\includepdf{2D_35_fast.pdf}

This does not surprise me, since if you include the PDF, the style of the object is not changed. Sadly this is not an option, because I would like that the Font and the Formulas match (This is the reason why I was using the .tex file).

I understand… I am just trying to find solutions … right now I am a bit short of them …

I have reduced the problem to something much smaller than your example. .tex file is:

\documentclass{a0poster}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\begin{document}
\par
\input{c1.tex}
\end{document}

the image c1.tex has been produced by a simple hpx->Draw() (hpx being the standard histogram from hsimple.root). When I use the a0poster document class I get:

When I use the article document class I get:

so, as you can see a0poster screws up the stats even is nothing has been added. And right now I have really no idea why …

As you need to have a quick solution to make your poster, one possible way is the following. In the . tex file the text in drawn by lines like:

[anchor= west] (15.8,11.909) node[scale=0.954572, color=c, rotate=0]{Entries };

the text size is defined by the value in the scale field. If you make a script to change this values you can adjust them with a size making a0poster happy. For instance I changed 0.954572 to 0.5 and I got readable stats sizes in the a0poster style. This is similar to what @ferhue proposed earlier.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.