1

I've been reading previous posts but wasn't able to find the right solution for my case.

I need a table like this:

+------+----------------[...]---------------+-------+
|      |                                    |       |
|      +----------------[...]---------------+       |
|      |                                    |       |
+------+----------------[...]---------------+-------+

First column should contain an image (i.e. a logo) the last should contain the name of the file itself. The title of the document and the title of the current chapter in the two cell in the center column.

I guess I have two options.

Option A) a table 2 rows by 3 columns, merging the cells in column 1 and merging the cells i column 3.

\begin{tabular}{|c|c|c|}
    \multirow{2}{*}{\includegraphics[height=20mm]{logo}} & %
    DOCUMENT TITLE & %
    \multirow{2}{*}{file_name.txt} \\
    \cline{2-2} & Chapter title & \\
\end{tabular}

The issue with this is related to image height: if it is too high, the image flows through the bottom border of the table.

Option B) a table 1 row by 3 columns, the center cell containing a tabular 2 rows by one column.

\begin{tabular}{|c|@{}c@{}|c|}
    \hline
    \includegraphics[height=40mm]{logo} & %
        \begin{tabular}{@{}c@{}}DOCUMENT~TITLE\\ \hline Chapter~Title\\\end{tabular} & %
        filename.txt \\
    \hline
\end{tabular}

The issue with this is that the contents of the cells rest on bottom of the cells and it not floating in the middle (I forced the height of the cell to a size bigger than really needed).

I tried both tabular* and tabularx but I wasn't able to find a solution.

Can you please help me with this with examples or pointers to pages I missed?

Many thanks in advance!

Cheers,

1

one solution may be drawing this page header with tikz. if i correctly understood your question, than you looking for something like this:

enter image description here

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{fit, positioning}
\usepackage{graphicx}
\usepackage{multirow, tabularx}

\begin{document}
\begin{center}
    \begin{tikzpicture}[
    node distance = 0pt,
       FIT/.style = {inner sep=0pt},
every node/.append  style = {draw, inner sep=2mm, outer sep=0pt},
every label/.append style = {font=\huge\bfseries}
                ]
\node (n1) [right]  {\includegraphics[height=22mm,width=15mm]{example-image-duck}};
\node (n3) [minimum height=26mm,left] at (\linewidth,0) {Filename.txt};
\node (n2a)[FIT, fit=(n1.north east) (n3.west),
            label=center:DOCUMENT TITLE] {};
\node (n2a)[FIT, fit=(n1.south east) (n3.west),
            label=center:Chapter title] {};
\end{tikzpicture}
\end{center}

\end{document}
  • Tanks Zarko! yes it looks like the result I am looking for. I'll try to put it in fancyhdr so as it printed in the header of each page. – Luca Jul 21 '18 at 14:39
0

How about this, with tabularx and adjustbox?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry} 
\usepackage{adjustbox}
\usepackage{tabularx}

\begin{document}

 \begin{center}
\begin{tabularx}{\linewidth}{c>{\centering\arraybackslash}X c}
 \adjincludegraphics[valign=c, scale=0.25]{AliceSteadman} & DOCUMENT TITLE & Filename. txt \\
  & Chapter title 
\end{tabularx}
\end{center}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.