2

I've been trying to make a table with tabular, and I'm having an issue when trying to align text top left in my table. This is what it looks like. enter image description here

I want the right and left text to be top-left aligned, but I dont't know what I should do. I would really appreciate some help. This is my code:

\begin{table}[h!]
    \centering
    \caption{Materials utilitzats per dur a terme l'experiment.}

    \begin{tabular}{ | p{5cm} | c | p{5cm} | }
    \hline
    \textbf{Materials} & \textbf{Fotografia} & \textbf{Descripció/Funció} \\ \hline
    Vareta roscada

    &

    \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{sample.png}
    \end{minipage}

    & 

      Vareta de metall rígida que suporta les boles de petanca.

    \\ \hline
    Vareta roscada

    &

    \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{sample.png}
    \end{minipage}

    & 

      Vareta de metall rígida que suporta les boles de petanca.

    \\ \hline
  \end{tabular}

    \caption{Materials utilitzats}
    \label{tab:my_label}
\end{table} 
2

The images are the ones set with their alignment at the baseline. If you adjust the baseline to the top (thanks to adjustbox), the remaining already-top-aligned paragraph columns line up as expected.

enter image description here

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[export]{adjustbox}

\begin{document}

\begin{table}[h!]
  \centering
  \caption{Materials utilitzats per dur a terme l'experiment.}

  \begin{tabular}{ | p{5cm} | c | p{5cm} | }
    \hline
    \textbf{Materials} & \textbf{Fotografia} & \textbf{Descripció/Funció} \\ \hline
    Vareta roscada &
    \includegraphics[width=.3\textwidth, height=60mm, valign=t]{example-image-a} & 
    Vareta de metall rígida que suporta les boles de petanca. \\
    \hline
    Vareta roscada &
    \includegraphics[width=.3\textwidth, height=60mm, valign=t]{example-image-b} & 
    Vareta de metall rígida que suporta les boles de petanca. \\
    \hline
  \end{tabular}
\end{table}

\end{document}
|improve this answer|||||
2

Like this:

enter image description here

\documentclass[draft]{article}
\usepackage[export]{adjustbox}  % <---load also graphicx

\begin{document}
    \begin{table}[ht]
    \centering
    \setkeys{Gin}{width=\linewidth, height=60mm}
\begin{tabular}{ | *{3}{p{\dimexpr0.333\linewidth-2\tabcolsep-0.66\arrayrulewidth} |} }
    \hline
    \textbf{Materials} & \textbf{Fotografia} & \textbf{Descripció/Funció} \\ \hline
Vareta roscada  
    &   \includegraphics[valign=t]{sample.png}
        &   Vareta de metall rígida que suporta les boles de petanca.   \\ 
    \hline
Vareta roscada
    &   \includegraphics[valign=t]{sample.png}
        &   Vareta de metall rígida que suporta les boles de petanca.   \\ 
    \hline
\end{tabular}
    \caption{Materials utilitzats}
\label{tab:my_label}
    \end{table}
\end{document}
|improve this answer|||||

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.