1

I'm new to LaTeX, I have a table and I want to add an image in the first column of my table and I want that it fits a column. Can you give me some advice how to do it correctly?

\documentclass{article}     
\usepackage{tabularx}
\usepackage{graphicx}   
\usepackage{fancyhdr}  
\usepackage[a4paper, portrait, margin=1in]{geometry}   
\usepackage{ucs}    
\usepackage[utf8x]{inputenc}   
\usepackage[russian]{babel}     

\pagestyle{fancy}    

\rhead{   
\begin{tabularx}{\textwidth}{X  X  X  X}    
\includegraphics[width=0.1\textwidth, height=15mm]{cat}&Класс документа: & Id  документа   & Название документа: \\

&Regulation       & 1        & СОП513                            \\

&Тип документа:   & № Версии документа: & Страница в документе:  \\   
&СОП              &  503   & \thepage                            \\    
\end{tabularx}    
}`    
\graphicspath{ {/home/Anton/} }    
\begin{document}
\noindent
hello world 
\end{document}

Here is what I have right now:

[

  • 1
    change the first X to c you want that column to fit its contents not (as X does) wrap the contents to a predetermined width. – David Carlisle Jan 27 '16 at 10:34
0

Here is a way, with a simple \raisebox. I also added input encoding, and had to change some parameters with geometry:

\documentclass{article}
\usepackage{tabularx}
\usepackage[demo]{graphicx}
\usepackage{fancyhdr}
\usepackage[a4paper, portrait, margin=1in, headheight=73pt, includehead]{geometry}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1,T2A]{fontenc}
\usepackage[russian]{babel}

\pagestyle{fancy}

\rhead{
\begin{tabularx}{\textwidth}{X X X X}
\raisebox{-\height}[0pt][0pt]{\includegraphics[width=0.1\textwidth, height=15mm]{cat}}&Класс документа: & Id документа & Название документа: \\
&Regulation & 1 & СОП513 \\
&Тип документа: & № Версии документа: & Страница в документе: \\
&СОП & 503 & \thepage
\end{tabularx}
}%`
%\graphicspath{ {/home/Anton/} }

\begin{document}

\noindent Blah blah blah

\end{document}

enter image description here

0

Another possibility is use multirow package:

\documentclass{article}
\usepackage{multirow,tabularx}% <-- added multirow
\usepackage[demo]{graphicx}
\usepackage{fancyhdr}
\usepackage[a4paper, portrait, margin=1in, headheight=73pt, includehead]{geometry}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1,T2A]{fontenc}
\usepackage[russian]{babel}

\pagestyle{fancy} 
\rhead{
\begin{tabularx}{\textwidth}{c X X X}%<--- see if "c" instead "X" column type is ok
\multirow{4}*{\includegraphics[width=0.1\textwidth, height=16mm]{cat}}
    &   Класс документа:    &   Id документа        &   Название документа:     \\
    &   Regulation          &   1                   &   СОП513                  \\
    &   Тип документа:      &   № Версии документа: &   Страница в документе:   \\
    &   СОП                 &   503                 &   \thepage
\end{tabularx}
}%`
%\graphicspath{ {/home/Anton/} }

\begin{document}

\noindent Blah blah blah

\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.