1

I want to vertically align image with the text in the table. Text begins after the image and is on the down side.The code I have been using is

 \documentclass[]{article}
\usepackage[export]{adjustbox}
\begin{document}


\begin{tabular}{p{3in} r}
     \includegraphics[height=3cm, valign=m]{logo.jpg}  & univname \\
       & deptname \\
       & Center for Advanced Studies in Chemistry\\
       & facname, placeln \\
       & Tel:  \\
       \hline
  \end{tabular}
\end{document}
4
  • Take a look at the valign option that is available when adding \usepackage[export]{adjustbox} to the preamble.
    – leandriis
    Commented Jun 25, 2020 at 5:34
  • 1
    Why do you use tabularx here? Since you don't have a X type column, a regular tabular is sufficient.
    – leandriis
    Commented Jun 25, 2020 at 5:35
  • Alternatively you could also use two side by side minipages. One for the image and the second for a single column table.
    – leandriis
    Commented Jun 25, 2020 at 5:43
  • You haven't stated how \btypeout, \univname, \deptname, \facname, or \placesh are defined, and you haven't provided access to logo.jpg. What exactly are you asking us to accomplish?
    – Mico
    Commented Jun 25, 2020 at 6:02

1 Answer 1

1

Welcome to TeX.SE!

  • Please in question always provide MWE (Minimal Working Example), a complete small document beggining with \documentclass and ending with `\end{document}, which reproduce your problem
  • used document class is unknown
  • In your code fragment is not defined commands \univname, \deptname, \facname and \placesh
  • in tabularx table at least one column had to be X type

enter image description here

\documentclass{article}
\usepackage[export]{adjustbox} % it load graphicx too
\usepackage{makecell, multirow, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
\begingroup
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{XL}
\multirow{7.4}{=}{\includegraphics[height=3cm, valign=m]{example-image-duck}}    %{Pictures/logo.jpg}} 
            & University name  \\
            & Department name \\
            & Center for advanced Studies in Chemistry \\
            & Faculty pretty long name in two columns\\
\end{tabularx}
\endgroup
\end{document}

Note: With valign you can move baseline of image to the top (options T or t) of image, (vertical) middle (options Morm) or to bottom (options B or b). For details see package documentation, subsection 4.6 Vertical Alignment, page 24.

8
  • Sorry, I do not know how to provide MWE. \univname, \deptname, \facname and \placesh corresponds to University name, department name , faculty name and local place name respectively. Thank you for the solution, however it didn't solved my problem you. I tried \valign=m but the text in two rows, in the next column, gets split. Please tell me any details you require
    – Harsh
    Commented Jun 25, 2020 at 10:14
  • @Harsh you can make an example as Zarko has done, You do not need those commands for university name, replace by any text University Faculty or whatever words you want, and use example-image as the image, the important thing is that you post a complete document that other people can run and shows the problem. Commented Jun 25, 2020 at 10:17
  • @David Carlisle I replaced University, faculty etc but that's not the problem, My image in 1 Column, splits my text between two adjacent rows in the next column, even after applying the provided solution. I also changed \tabularx to \tabular.
    – Harsh
    Commented Jun 25, 2020 at 10:24
  • 1
    @Harsh it is not a problem for you but it is a problem for everybody else as no one can run your example or see the problem that you are asking about. See the example in Zarko's answer, anybody can run that and test it works on their system. No one, not even you, can run the example as posted in your question. You need to edit your question to show the problem otherwise no one will know what the problem is. Commented Jun 25, 2020 at 10:31
  • @DavidCarlisle Well can you guide me how to do that? Shall I copy, paste my entire code beginning from documentclass?
    – Harsh
    Commented Jun 25, 2020 at 10:45

You must log in to answer this question.

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