1

I am trying to convert a table from MS Word to LaTeX that contains a large image at the first column and several lines of text on the right-hand side. As a beginner, I have no idea how I can achieve this. I am using 2 column document. Can it be contained within one column?

enter image description here

Please help.

EDIT: Although I could not do it but I am providing the MWE for my document to give an idea of what packages I am using already.

\documentclass[twocolumn]{svjour3}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{comment}
\usepackage[center]{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[misc]{ifsym}
\usepackage{csquotes}
\usepackage[section]{placeins}
\usepackage[linesnumbered,lined,boxed,commentsnumbered]{algorithm2e}
\usepackage{amsmath}
\usepackage{graphicx}

%Table packages
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[figuresright]{rotating}
\setlength{\rotFPtop}{0pt plus 1fil}
\usepackage{makecell}
\renewcommand{\theadfont}{\bfseries}
\renewcommand{\theadfont}{\footnotesize\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx} 
\usepackage{multirow}

\begin{document}
% just a random table from this article

% System Components
\begin{table}
% table caption is above the table
\caption{Hardware components and specifications}
\label{tab:2}       % Give a unique label
% For LaTeX tables use
\begin{tabularx}
                {\linewidth}{>{\raggedright\arraybackslash}p{1in}
                            >{\raggedright\arraybackslash}p{1in}
                             X
                             }
\toprule
\thead{Component} &\thead{ Hardware\\specification} & \thead{Architecture\\application}\\
\midrule\\
\textbf{Android Mobile} & Redmi 4A with Android 8.0, 2GB RAM, 16GB ROM & Client device for data acquisition  \\
\addlinespace
\textbf{Processing and monitoring Unit} & Raspberry Pi 4 with 4GB RAM on latest Raspbian OS (December 2020)   &  Main processing unit that runs all the algorithms.\\
\addlinespace
\textbf{Wi-Fi Router(Optional)} & Mi Band-3 high speed router with 70 Mbps Broadband connection & The communication hub for the architecture in indoor monitoring.\\
\noalign{\smallskip}\hline
\end{tabularx}
\end{table}
\end {document}

Source image enter image description here

4
  • 1
    Difficult. To us are unknown image size, document layout ... What you try so far? Image can be inserted in multirow cell.
    – Zarko
    Commented Mar 31, 2021 at 19:37
  • The image and the text that is shown in the OP is the actual one. The same image can be reused. Usually, I do not ask for help without trying and providing the MWC of my trial. But this time I have no idea where to start. Similar posts deal with text and image in 1:1 ratio. So they are not really helping.
    – Bukaida
    Commented Mar 31, 2021 at 19:51
  • A MWE that at least shows the documentclass you currently use as well as the code that produces the table would be really helpful here.
    – leandriis
    Commented Mar 31, 2021 at 19:57
  • I have added MWE of another table to show the working environment as per leandriis suggestion.
    – Bukaida
    Commented Apr 1, 2021 at 6:47

2 Answers 2

2

Use of tabularx for table was correct way ...

After small tweaks it can be obtain the following result:

enter image description here

\documentclass[twocolumn]{svjour3}
\usepackage{csquotes}
\usepackage[section]{placeins}
\usepackage{graphicx}

%Table packages
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand{\theadfont}{\footnotesize\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}% new

\usepackage{lipsum} % new, for dummy text filler

\begin{document}
\lipsum[1]
    \begin{table}[ht]
\caption{Hardware components and specifications}
\label{tab:2}
    \small
    \sisetup{product-units = single}
    \setcellgapes{2pt}
    \makegapedcells
    \setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{@{}>{\hsize=1.1\hsize}X  
                             @{\quad}l 
                                >{\hsize=0.9\hsize}L @{}}
    \cmidrule[\heavyrulewidth]{2-3}
\multirow{22}{=}{\includegraphics[height=22\baselineskip,
                                  width=\linewidth]{example-image-duck}}
    &  Model
        &   \thead[l]{Xiaomi Redmi 4a}                      \\
    \cmidrule{2-3}
     & OS           & Android~8.0                           \\
     & Size         & \SI{14 x 0.9 x 7}{\centi\meter}       \\
     & CPU          & \SI{1.4}{\giga\hertz} Qualcomm Snapdragon~425 64-bit Cortex~A53 quad core processor           \\
     & RAM/ROM      & \SI{3}{\giga B}/\SI{32}{\giga B} \\
     & Resolution   & \SI{1280 x 720}{pixels} resolution and \SI{296}{pixel} density        \\
     & Connectivity & Wi-Fi~802.11~b/g/n, Bluetooth~4.0     \\
     & Sensor       & on board BMI160 accelerometer         \\
     & Weight       & \SI{132}{\gram}                       \\
     & Battery      & \SI{3120}{\milli\ampere}              \\
     & GPS          & A-GPS, Glonass                        \\
    \cmidrule{2-3}
\end{tabularx}
    \end{table}
\lipsum[2-6]
\end{document}

As you can see from MWE, in comparison to your MWE the following changes/tweaks is done:

  • for units is used siunitx package
  • table use \small font size
  • removed are vertical lines and the most of horizontales (that table has more "professional looks
  • to each rows is inserted vertical paddings of 2pt by use of makegapedcells defined in the makecell package
  • test in the last two columns are left aligned
1
  • Thank you Zarko, with a little trial and error with the size specification of your code, I could get almost like the picture in OP. It was impossible for me at my current learning stage to produce such code. Maybe one day I will also be able to do such a level of coding.
    – Bukaida
    Commented Apr 1, 2021 at 11:13
1

You can use the multirow package and the \multirow command it provides. In the following, I've also used \makecell from the makecell package to easily add linebreaks to cells in the tabular.

\documentclass{article}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{graphicx}
\begin{document}
\begin{center}
\begin{tabular}{c|c|c|}
    \cline{2-3}
    \multirow{11}{*}{\includegraphics[scale=0.67]{example-image-9x16}}
     &     Model     &                              \textbf{Xiaomi Redmi~4a}                               \\
    \cline{2-3}
     &      OS       &                                     Android~8.0                                     \\
    \cline{2-3}
     &     Size      &                             $14 \times 0.9 \times 7$ cm                             \\
    \cline{2-3}
     &      CPU      & \makecell{1.4~GHz Qualcomm\\Snapdragon~425 64-bit\\Cortex~A53 quad core\\processor} \\
    \cline{2-3}
     & RAM\slash ROM &                                  3~GB\slash 32 GB                                   \\
    \cline{2-3}
     &  Resolution   &       \makecell{$1280 \times 720$ pixels\\resolution and 296\\pixel density}        \\
    \cline{2-3}
     & Connectivity  &                    \makecell{Wi-Fi~802.11~b/g/n,\\Bluetooth~4.0}                    \\
    \cline{2-3}
     &    Sensor     &                      \makecell{ON BOARD BMI160\\ACCELEROMETER}                      \\
    \cline{2-3}
     &    Weight     &                                      132~Grams                                      \\
    \cline{2-3}
     &    Battery    &                                       3120~mA                                       \\
    \cline{2-3}
     &      GPS      &                                   A-GPS, Glonass                                    \\
    \cline{2-3}
\end{tabular}
\end{center}
\end{document}

enter image description here

I'm not sure whether the table really looks all that good with all those horizontal/vertical lines, BTW --- YMMV of course. Usually I recommend the booktabs package and its \toprule, \midrule, \cmidrule and \bottomrule commands, but those tend to produce tables that look like they're straight out of scientific articles (which is great if that's what you're actually writing, of course).

5
  • It is overflowing to the second column. I have added the source image and MWE (of another table), see if it helps. There is no need to have internal grids if it does not look good. I am writing a technical document only.
    – Bukaida
    Commented Apr 1, 2021 at 6:59
  • I see --- try using table* instead of table, that should span both columns.
    – chsk
    Commented Apr 1, 2021 at 7:13
  • Spanning it to both columns will mess up with the existing document structure, which as a novice, will be impossible for me to re-arrange( it is in page 7 of a 13 page document). Can it be accommodated within one column by reducing the font size? Pardon my ignorance, I am just a beginner.
    – Bukaida
    Commented Apr 1, 2021 at 7:18
  • Hmm, I'm not entirely sure what you mean by "messing up the document structure" or what you mean by "re-arranging". tables are floating environments, whether you have one spanning two columns or just one; LaTeX will try to figure out where to best place them. If you want something right there your best bet is to not use a tableat all (you can still use a tabular of course!).
    – chsk
    Commented Apr 1, 2021 at 7:59
  • Re: making things fit, if you absolutely must have the table (i.e. the tabular, not the table) in a column, then yes, you can switch to a smaller font. I have little experience with this, but see e.g. latexref.xyz/Font-sizes.html#Font-sizes . I would suggest taking a step back and asking yourself whether it's really necessary to have a table right there and within a single column though.
    – chsk
    Commented Apr 1, 2021 at 8:03

You must log in to answer this question.

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