TransWikia.com

Figures and table side by side using the whole page width

TeX - LaTeX Asked by Enzo Bom on November 1, 2021

Currently I am making a design/layout on LaTeX for some specific kind of reports and I am struggling a little bit to achieve something. I want to add a figure, a table with some information and another figure, all side by side, but I want them to use the whole page width instead of the text width.

I could say that I managed to make it, but I feel it’s more like a workaround, so I wanted to know if there is a more consistent way of achieving it, where I can specify (to some extent) a place for each element to be placed. I tried using minipage, for example, but I didn’t really succeed and all topics I found concerning a similar problem consider the text width.

The way I am doing it now is like this:

documentclass{article}
usepackage[utf8]{inputenc}

usepackage[a4paper, total={160mm,200mm},showframe]{geometry}

usepackage{graphicx}

begin{document}

makebox[linewidth]{%
    includegraphics[width=0.25linewidth]{example-image-a}
    raisebox{1.4cm}{
    small{
    begin{tabular}{c}
        Street, number \
        Postal Code, City \
        Country \[0.3cm]
        [email protected]\
        www.website.com
    end{tabular}}}
    hspace{3mm} includegraphics[width=0.75textwidth, height=0.15textheight]{example-image-b}
}

end{document}

Any input will be very appreciated! Also if this way I am doing it is fine, I would be glad to hear from someone else! 🙂

Thanks!

2 Answers

Small variation of @leandriis answer (+1):

documentclass{article}
usepackage[a4paper, 
            total={160mm,200mm},
            showframe
            ]{geometry}
usepackage[export]{adjustbox} % it load graphicx too
usepackage{tabularx}
usepackage[strict]{changepage}

begin{document}
    begin{adjustwidth}{-25mm}{-25mm}
    setkeys{Gin}{width=linewidth, height=24mm}
begin{tabular*}{linewidth}{@{}
                            p{dimexpr0.25linewidth-tabcolsep}
                            p{dimexpr0.25linewidth-2tabcolsep}
                            p{dimexpr0.50linewidth-tabcolsep}
                             @{}}
includegraphics[valign=t]{example-image-duck}
    &   small
        begin{tabular}[t]{l}
        Street, number \
        Postal Code, City \
        Country \[0.3cm]
        [email protected]\
        www.website.com
        end{tabular}
        &   includegraphics[valign=t]{example-image}
end{tabular*}
    end{adjustwidth}
end{document}

enter image description here

Answered by Zarko on November 1, 2021

Here is my suggestion using the adjustwidth environment from the changepage package and valign=c from adjustbox:

enter image description here

documentclass{article}
usepackage[utf8]{inputenc}

usepackage[a4paper, total={160mm,200mm},showframe]{geometry}

usepackage{graphicx}

usepackage{changepage} % for the adjustwidth environment
usepackage[export]{adjustbox} % offers the valign option

begin{document}

begin{adjustwidth}{-2.5cm}{-2.5cm}
    includegraphics[width=0.25linewidth, valign=c]{example-image-a}
    hfill
    small
    begin{tabular}{c}
        Street, number \
        Postal Code, City \
        Country \[0.3cm]
        [email protected]\
        www.website.com
    end{tabular}
    hfill
    includegraphics[width=0.75textwidth, height=0.15textheight, valign=c]{example-image-b}
end{adjustwidth}
end{document}

Answered by leandriis on November 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP