#StackBounty: #floats #pdftex #eps Create eps files from LaTeX figures

Bounty: 50

I recently submitted a paper in a journal that was accepted but the editor is requesting all the Figures to be exported in an .eps format. My figures are using different eps files every time but most of my figures have subfigures that have different scales, minipages and so on. For instance Figure 1 has 4 subfigures (each of them is already an eps image) but the editor requires an eps image that has those subfigures placed the way I want them to be placed in the article. I know how to export a LaTeX file as a pdf but I do not know if it is possible to export a LaTeX file as eps file. Also I want to keep the quality of the images intact so I would like to save them with the highest resolution possible. Does anyone know how to do that?


Get this bounty!!!

#StackBounty: #floats #tcolorbox #minipage tcolorbox/minipage: How to automatically set the image height to that of its parent's?

Bounty: 50

For the following, I need to

1- automatically set each image height to that of the parent minipage/tcolorbox instead of doing it manually by height=2cm

2- understand why example-image-a inside the minipage is going over the right margin

enter image description here

documentclass[12pt,a4paper]{article}
usepackage{graphicx}
usepackage[most]{tcolorbox}
usepackage[showframe]{geometry}

begin{document}

noindent
setlength{fboxsep}{0pt}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        First line\ Second Line
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        centering Centered Text
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        flushright includegraphics[height=2cm]{example-image-a}
    end{minipage}}%


vspace{2baselineskip}

begin{tcbraster}[
        raster columns=3, raster rows=1,
        raster height = 2cm, sharp corners,
        valign=center,
        raster column skip = 0mm,
        boxrule = 0.5pt, colback = white,
        boxsep=0mm, left=0pt, right=0pt
    ]
    begin{tcolorbox}[left=0pt,right=0pt]
        First line\ Second Line
    end{tcolorbox}
    begin{tcolorbox}[halign=center]
        Centered Text
    end{tcolorbox}
    begin{tcolorbox}[halign=right]
        includegraphics[height=2cm]{example-image-b}
    end{tcolorbox}
end{tcbraster}

end{document}


Get this bounty!!!

#StackBounty: #floats #tcolorbox #minipage tcolorbox/minipage: How to automatically set the image height to that of its parent's?

Bounty: 50

For the following, I need to

1- automatically set each image height to that of the parent minipage/tcolorbox instead of doing it manually by height=2cm

2- understand why example-image-a inside the minipage is going over the right margin

enter image description here

documentclass[12pt,a4paper]{article}
usepackage{graphicx}
usepackage[most]{tcolorbox}
usepackage[showframe]{geometry}

begin{document}

noindent
setlength{fboxsep}{0pt}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        First line\ Second Line
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        centering Centered Text
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        flushright includegraphics[height=2cm]{example-image-a}
    end{minipage}}%


vspace{2baselineskip}

begin{tcbraster}[
        raster columns=3, raster rows=1,
        raster height = 2cm, sharp corners,
        valign=center,
        raster column skip = 0mm,
        boxrule = 0.5pt, colback = white,
        boxsep=0mm, left=0pt, right=0pt
    ]
    begin{tcolorbox}[left=0pt,right=0pt]
        First line\ Second Line
    end{tcolorbox}
    begin{tcolorbox}[halign=center]
        Centered Text
    end{tcolorbox}
    begin{tcolorbox}[halign=right]
        includegraphics[height=2cm]{example-image-b}
    end{tcolorbox}
end{tcbraster}

end{document}


Get this bounty!!!

#StackBounty: #floats #tcolorbox #minipage tcolorbox/minipage: How to automatically set the image height to that of its parent's?

Bounty: 50

For the following, I need to

1- automatically set each image height to that of the parent minipage/tcolorbox instead of doing it manually by height=2cm

2- understand why example-image-a inside the minipage is going over the right margin

enter image description here

documentclass[12pt,a4paper]{article}
usepackage{graphicx}
usepackage[most]{tcolorbox}
usepackage[showframe]{geometry}

begin{document}

noindent
setlength{fboxsep}{0pt}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        First line\ Second Line
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        centering Centered Text
    end{minipage}}%
fbox{%
    begin{minipage}[t][2cm][c]{dimexprtextwidth/3}
        flushright includegraphics[height=2cm]{example-image-a}
    end{minipage}}%


vspace{2baselineskip}

begin{tcbraster}[
        raster columns=3, raster rows=1,
        raster height = 2cm, sharp corners,
        valign=center,
        raster column skip = 0mm,
        boxrule = 0.5pt, colback = white,
        boxsep=0mm, left=0pt, right=0pt
    ]
    begin{tcolorbox}[left=0pt,right=0pt]
        First line\ Second Line
    end{tcolorbox}
    begin{tcolorbox}[halign=center]
        Centered Text
    end{tcolorbox}
    begin{tcolorbox}[halign=right]
        includegraphics[height=2cm]{example-image-b}
    end{tcolorbox}
end{tcbraster}

end{document}


Get this bounty!!!

#StackBounty: #floats #plain-tex #output-routine PlainTeX: Float(s) lost with custom output routine

Bounty: 100

I use PlainTex because I like its simplicity and because I understand almost all lines of its code. When I look at the output routine of LaTeX I only understand a little bit.

So I trie to add floats on my own to PlainTex, my first trial can be seen here:
How to keep the order of floats in Plain TeX?

I would like to get a similar float handling as in LaTeX but with the possibility to understand the code. As there is no documentation for more complex output routines I have a question now.

Look at my MWE:

% Plain LuaTeX (for other engines: protecteddefglet{globallet})
fonttestfont=cmr17 at 20 pt% to show the problem better

testfont
normalbaselineskip24pt
normalbaselines

catcode`@=11
parskipz@
raggedbottom
% The sizes have to be calculated in output.
newdimenfullhsize
newdimenfullvsize
fullhsizehsize
fullvsizevsize

newdimen@colroom
@colroomfullvsize
% Float boxes as in latex.ltx
newinsertbx@A
newinsertbx@B
newinsertbx@C
newinsertbx@D
newinsertbx@E
newinsertbx@F
newinsertbx@G
newinsertbx@H
newinsertbx@I
newinsertbx@J
% Float handling parameters:
newcount@topnum
newcountmaxtopnum maxtopnumthr@@
newdimen@toproom
newdimenmaxtoproom maxtoproom.4fullvsize

newcount@botnum
newcountmaxbotnum maxbotnumtw@
newdimen@botroom
newdimenmaxbotroom maxbotroom.3fullvsize

newifif@insert
newifif@trybottom
def@empty{}
% Similar to latex.ltx:
def@freelist{bx@Abx@Bbx@Cbx@Dbx@Ebx@Fbx@Gbx@Hbx@Ibx@J}
let@toplist@empty
let@botlist@empty
let@deferlist@empty
% List handling macros:
def@additem#1#2{%
    expandaftergdefexpandafter#1expandafter{#1#2}}

def@takefirstitem#1{%
    expandafter@@takefirstitem#1!%
    glet#1=@tempa}

def@@takefirstitem#1#2!{gdef@currbox{#1}%
    def@tempa{#2}}
% A primitive definiton of a float:
deffloat#1{% #1=1 -> top float, 2 -> top or bottom float, 3 -> bottom float
    @takefirstitem@freelist
    globalcount@currbox#1relax
    globalsetbox@currboxvboxbgroup
    parskipz@}

defendfloat{parvskipz@egroup
    penalty-40000relax
    dimen@prevdepth
    vbox{}
    prevdepthdimen@
    penalty-30000relax}

def@nextboxcnt{% type of the next float on deferlist
    expandafterexpandafterexpandafter
    countexpandafter@firstofmany@deferlist!}

def@nextboxht{% height of the next float on deferlist
    expandafterexpandafterexpandafter
    htexpandafter@firstofmany@deferlist!}

def@firstofmany#1#2!{#1}

% Output routine
output{myoutput}
defmyoutput{%
    ifnumoutputpenalty=-40000relax
%   ifvoidfootinselseinsertfootins{unvboxfootins}fi
    globalsetbox@nevbox{unvbox@cclv}%
    else
    ifnumoutputpenalty=-30000relax
    setbox8box@cclv
    unvbox@ne
    ifvoidfootinselseinsertfootins{unvboxfootins}fi
    %unvbox@cclv
    %
    ifcasecount@currboxor%1 top float
    @inserttrue
    ifx@deferlist@empty else @insertfalsefi
    ifx@botlist@empty else @insertfalsefi
    ifnum@topnum<maxtopnum else @insertfalsefi
    ifnum@topnum>z@ ifdimmaxtoproom<dimexpr@toproom+ht@currboxrelax @insertfalsefifi
    if@insert
    expandafter@additemexpandafter@toplist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@toproomht@currbox
    globaladvance@topnum@ne
    else
    expandafter@additemexpandafter@deferlist@currbox
    fi
    %
    or%2 top or bottom float
    @inserttrue
    @trybottomfalse
    ifx@deferlist@empty else @insertfalsefi
    ifx@botlist@empty else @insertfalsefi
    ifnum@topnum<maxtopnum else @insertfalsefi
    ifnum@topnum>z@
    ifdimmaxtoproom<dimexpr@toproom+ht@currboxrelax @insertfalsefifi
    if@insert
    expandafter@additemexpandafter@toplist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@toproomht@currbox
    globaladvance@topnum@ne
    else
    ifx@deferlist@empty @trybottomtrue
    else expandafter@additemexpandafter@deferlist@currboxfi
    fi
    %
    if@trybottom
    @inserttrue
    ifdimht@currbox>@colroom @insertfalsefi
    ifnum@botnum<maxbotnum else @insertfalsefi
    ifnum@botnum>z@
  ifdimmaxbotroom<dimexpr@botroom+ht@currboxrelax @insertfalsefifi
    if@insert
    expandafter@additemexpandafter@botlist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@botroomht@currbox
    globaladvance@botnum@ne
    else
    expandafter@additemexpandafter@deferlist@currbox
    fi
    %
    fi
    %
    or%3 bottom float
    @inserttrue
    ifx@deferlist@empty else @insertfalsefi
    ifdimht@currbox>@colroom @insertfalsefi
    ifnum@botnum<maxbotnum else @insertfalsefi
    ifnum@botnum>z@
  ifdimmaxbotroom<dimexpr@botroom+ht@currboxrelax @insertfalsefifi
    if@insert
    expandafter@additemexpandafter@botlist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@botroomht@currbox
    globaladvance@botnum@ne
    else
    expandafter@additemexpandafter@deferlist@currbox
    fi
    %    
    fi
    %
    else
    shipoutvbox{makeheadlinepagebodymakefootline}%
    advancepageno
    % Prepare next page/column:
    global@colroomfullvsize
    global@topnumz@
    global@toproomz@
    global@botnumz@
    global@botroomz@
    %
    ifx@deferlist@emptyelse
    % Top floats
    loop
    @inserttrue
    ifnum@nextboxcnt<z@ @insertfalsefi
    ifnum@nextboxcnt>tw@ @insertfalsefi
    ifnum@topnum<maxtopnum else @insertfalsefi
    ifnum@topnum>z@
   ifdimmaxtoproom<dimexpr@toproom+@nextboxhtrelax @insertfalsefifi
    if@insert
    @takefirstitem@deferlist
    expandafter@additemexpandafter@toplist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@toproomht@currbox
    globaladvance@topnum@ne
    fi
    ifx@deferlist@empty @insertfalsefi
    if@insert
    repeat
    %
    fi
    %
    ifx@deferlistemptyelse
    % Bottom floats:
    loop
    @inserttrue
    ifnum@nextboxcnt<tw@ @insertfalsefi
    ifdim@nextboxht>@colroom @insertfalsefi
    ifnum@botnum<maxbotnum else @insertfalsefi
    ifnum@botnum>z@
   ifdimmaxbotroom<dimexpr@botroom+@nextboxhtrelax @insertfalsefifi
    if@insert
    @takefirstitem@deferlist
    expandafter@additemexpandafter@botlist@currbox
    globaladvance@colroom-ht@currbox
    globaladvance@botroomht@currbox
    globaladvance@botnum@ne
    fi
    ifx@deferlist@empty @insertfalsefi
    if@insert
    repeat
    %
    fi
    %
    ifnumoutputpenalty=-@MM dosuperejectfi
    fi
    fi
    ifnumoutputpenalty<-30000relax
        globalvsizemaxdimenelseglobalvsize@colroomfi}

defpagebody{vbox tofullvsize{boxmaxdepthmaxdepth pagecontents}}

%pagecontents that insert top and bottom floats:
defpagecontents{ifx@toplist@emptyelse
    loop
    @takefirstitem@toplist
    expandafter@additemexpandafter@freelist@currbox
    box@currbox
    unlessifx@toplist@emptyrepeat
    fi
    %
    dimen@=dp@cclv unvbox@cclv % open up box255
    %
    ifx@botlist@emptyelse
    loop
    @takefirstitem@botlist
    expandafter@additemexpandafter@freelist@currbox
    box@currbox
    unlessifx@botlist@emptyrepeat
    fi
    ifvoidfootinselse % footnote info is present
    vskipskipfootins
    footnoterule
    unvboxfootinsfi
    ifr@ggedbottom kern-dimen@ vfil fi}

1. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

float1 ABCD1 vskip20ptendfloat

float1 ABCD2 vskip20ptendfloat

float1 ABCD3 vskip20ptendfloat

float1 ABCD4 vskip20ptendfloat

float1 ABCD5 vskip20ptendfloat

float1 ABCD6 vskip20ptendfloat

2. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.%

float1 ABCD7 vskip20ptendfloat% disappears

float1 ABCD8 vskip20ptendfloat

3. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

4. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

5. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

bye

As you can see in the picture the 7th float disappears. This is a known problem near pagebreaks. I know that LaTeX fixes this by adding 2 penalties. I tried this, too, with penalty-40000 but without success.

What am I doing wrong?

(Edit: a better output routine, same result.)

enter image description here


Get this bounty!!!

#StackBounty: #pgfplots #floats #tikzscale pgfplots: set effective width of figure if no label given

Bounty: 50

How to ensure that the set width of pgfplot figure is correctly applied in case I do not have a label?

Please consider the example below

documentclass{article}

usepackage{pgfplots,calc,filecontents,tikzscale}

begin{filecontents*}{test.tikz}
    begin{tikzpicture}%
        begin{axis}[width=120pt,height=3cm]%
        addplot[domain=-3:3] {sin(deg(x))};%
        end{axis}%
    end{tikzpicture}%
end{filecontents*}

begin{filecontents*}{test-label.tikz}
    begin{tikzpicture}%
    begin{axis}[width=120pt,height=3cm,ylabel=ylabel]%
    addplot[domain=-3:3] {sin(deg(x))};%
    end{axis}%
    end{tikzpicture}%
end{filecontents*}

defmymacro{input{test.tikz}}
defmymacrolabel{input{test-label.tikz}}

defmymacroscaleonlyaxis{includegraphics[width=120pt,height=3cm]{test.tikz}}
defmymacrolabelscaleonlyaxis{includegraphics[width=120pt,height=3cm]{test-label.tikz}}

newlength{test}
begin{document}
    mymacro%
    settowidth{test}{mymacro}%

    thetest

    mymacrolabel%
    settowidth{test}{mymacrolabel}%

    thetest

    mymacroscaleonlyaxis%
    settowidth{test}{mymacroscaleonlyaxis}%

    thetest

    mymacrolabelscaleonlyaxis%
    settowidth{test}{mymacrolabelscaleonlyaxis}%

    thetest
end{document}

The cases where a ylabel is set, are scaled almost correctly (ca. 118pt instead of the desired 120pt).
But the figures without label are not scaled correctly in either case.
How to fix that?

enter image description here


Get this bounty!!!