2

I'm trying to replicate this table I made in MS Word, but I'm having a hard time figuring out the best way to accomplish this.

Example

I'd like to specify all dimensions, such as image dimensions (height=1cm, width depends on aspect ratio), image padding (left=1mm, right=2mm, top=1mm, bottom=1mm), and row height (1.2cm) and width (10cm).

I have looked through a lot of StackExchange questions. I've managed two lines of text in a cell with makecell and I've managed to wrap text around an image with wrapfig, but doing both inside a table is proving very difficult. I'm not an experienced LaTeX user. Any pointers would be greatly appreciated!

As for code: I only have a few lines where I tried several different partial solutions:

\documentclass[twoside]{book}

\pagestyle{empty}
\usepackage[paperwidth=125mm, paperheight=190mm, top=1cm, bottom=1cm, inner=2cm, outer=1cm, headheight=0mm, headsep=0mm, marginparwidth=0mm, marginparsep=0mm, footskip=0mm]{geometry}
\special{papersize=125mm,190mm}

\usepackage[utf8]{inputenc}
\usepackage{fourier} 
\usepackage{array}
\usepackage{makecell}
\renewcommand\theadalign{cb}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

%\usepackage[dvipsnames,table]{xcolor}
%\usepackage{array}
%\usepackage{environ}
%\usepackage{tikz}

\usepackage[table]{xcolor}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array

\usepackage{wrapfig}

%\usepackage{showframe}

\begin{document}

%\begin{table}[h!]
%   \centering
%   \begin{tabular}{ | c | c | c | }
%       \hline
%       teste & teste & teste \\ \hline
%       \includegraphics[width=10cm]{../ScriptMapa/exp/pt1.png}
%       &
%       %\begin{minipage}[t]{5cm}
%       teste
%       %\end{minipage}
%       & 
%       %\begin{minipage}{5cm}
%   teste
%       %\end{minipage}
%       \\ \hline
%   \end{tabular}
%\end{table}

\noindent
\begin{tabular}{|l|}
    \hline
    \makecell[{{p{3cm}}}]{teste \\ teste}\\
    \hline
\end{tabular}

\end{document}
  • Welcome to TeX.SX! Please help us help you by providing us with the code you already have (MWE). – TeXnician Jul 1 '17 at 11:32
  • How can you have a width of 10 cm, an image with a width depending on aspect ratio and a predefined padding? – Bernard Jul 1 '17 at 12:03
  • @Bernard from left to right: 1mm padding, image with variable width, 2mm padding, text, blank space to make the total of 10cm. – fseixas Jul 1 '17 at 12:53
  • @TeXnician I have edited the question with my code. – fseixas Jul 1 '17 at 17:39
0

I think you can easily get what you need with tikz, but with a width of 10cm the gray line goes beyond the right page margin, as you can see with showframe package.

\documentclass[twoside]{book}
\pagestyle{empty}
\usepackage[paperwidth=125mm, paperheight=190mm, top=1cm, bottom=1cm, inner=2cm, outer=1cm, headheight=0mm, headsep=0mm, marginparwidth=0mm, marginparsep=0mm, footskip=0mm]{geometry}
\special{papersize=125mm,190mm}
\usepackage[utf8]{inputenc}
\usepackage{fourier} 
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{showframe}

\begin{document}
    \noindent
    \begin{tikzpicture}
        \node[minimum height=1.2cm, minimum width=10cm, fill=gray!30, inner sep=0] 
                (A) at (0,0) {};% a width of 10cm goes beyond page margin
        \node[inner sep=0, right=1mm of A.west] (B) {\includegraphics[height=1cm]{FlagPortugal}};
        \node[inner sep=0, right=2mm of B.east, text width=7cm] {{\large Line one} \\ Line two};
    \end{tikzpicture}
\end{document}

enter image description here

  • That's (almost) perfect, I will be able to tweak it to my needs. Thanks a lot! – fseixas Jul 6 '17 at 10:53
  • @fseixas You're welcome, thank you for accepting my answer! – CarLaTeX Jul 6 '17 at 10:55

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.