2

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.25\linewidth]{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.75\textwidth, height=0.15\textheight]{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!

4
  • what exactly do you want to change in your output -- a handrawn sketch could clarify
    – js bibra
    Commented Jul 21, 2020 at 9:00
  • @jsbibra thanks for the answer! Actually the output is fine... my doubt is whether there is a better way to achieve the same output (the three elements side by side occupying more than the textwidth), because I think my approach is not consistent... I have to adjust the positions with \hspace every time I want to change something and I always have the warning "overful \hbox". P.S.: sorry for not adding images. I tried to but then the only option is to insert a link.
    – Enzo Bom
    Commented Jul 21, 2020 at 9:16
  • Probabyl using the changepage package could help here?
    – leandriis
    Commented Jul 21, 2020 at 9:43
  • @leandriis definitely helped! Thanks!
    – Enzo Bom
    Commented Jul 21, 2020 at 10:29

2 Answers 2

2

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.25\linewidth, 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.75\textwidth, height=0.15\textheight, valign=c]{example-image-b}
\end{adjustwidth}
\end{document}
2

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.25\linewidth-\tabcolsep}
                            p{\dimexpr0.25\linewidth-2\tabcolsep}
                            p{\dimexpr0.50\linewidth-\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

2
  • I agree with you for the +1 :-)
    – Sebastiano
    Commented Jul 21, 2020 at 12:33
  • 1
    @Sebastiano, thank you! Now I slightly improve my design ... so it is now nicer (to my taste).
    – Zarko
    Commented Jul 21, 2020 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .