2

Hello I'm very new to LaTeX, and how it works.

I want to make a table with 6 columns and x amount of rows.

\section*{\centerline {Counter-Strike: Global Offensive}}
Her finder du information om de forskellige skins du gerne vil have.
Tabellen med information er sidst opdateret den \today. \\

\begin{longtable}{|l|l|l|l|l|l|} \hline
Våben  &Navn på skin  &Stattrak  &Kvalitet &Pris &Billede \\ \hline

AUG       &Torque  &Ja  &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal - Wear\\Factory-New\end{tabular} 
                        &\begin{tabular}[c]{@{}l@{}}1 euro\\1,6 euro \\2,4 euro \end{tabular}  
                        &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

AWP       &Redline &Ja  &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular}
                        &\begin{tabular}[c]{@{}l@{}}24 euro\\46 euro \\D.E \end{tabular}   
                        &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

CZ75 Auto   &Tigris  &Ja  &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular}
                          &\begin{tabular}[c]{@{}l@{}}2 euro\\4,5 euro \\13,7 euro \end{tabular} 
                          &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Desert eagle &Hypnotic &Ja    &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular}
                              &\begin{tabular}[c]{@{}l@{}}D.E\\29 euro \\15,90 euro \end{tabular} 
                              &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Famas &Pulse &Ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular}
                 &\begin{tabular}[c]{@{}l@{}}1,2 euro\\1,6 euro \\2,8 euro \end{tabular} 
                 &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Scout/SSG08 & Abyss &Ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular}
                        &\begin{tabular}[c]{@{}l@{}}0,3 euro\\0,9euro \\4,4 euro \end{tabular} 
                        &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

 Usp-S & Caiman &Ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                    &\begin{tabular}[c]{@{}l@{}}6 euro\\11 euro \\15,2 euro \end{tabular} 
                    &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

\pagebreak

Five-Seven & Kami & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                       &\begin{tabular}[c]{@{}l@{}}0,1 euro\\0,2 euro \\0,3 euro \end{tabular} 
                       &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

G3SG1 & Azure Zebra & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                         &\begin{tabular}[c]{@{}l@{}}0,2 euro\\0,2 euro \\0,3 euro \end{tabular} 
                         &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Galil AR & Blue Titanium & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                              &\begin{tabular}[c]{@{}l@{}}D.E\\D.E\\0,6 euro \end{tabular} 
                              &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Glock-18 & Water Element & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                              &\begin{tabular}[c]{@{}l@{}}16 euro\\24 euro \\38,1 euro \end{tabular} 
                              &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

M4A1-S & Guardian & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                       &\begin{tabular}[c]{@{}l@{}}20,1 euro\\28,2 euro \\39,7 euro \end{tabular} 
                       &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

M4A4 & Bullet Rain & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                        &\begin{tabular}[c]{@{}l@{}}22,4 euro\\33,7 euro \\66,8 euro \end{tabular} 
                        &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Mag 7 & Heaven Guard & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                          &\begin{tabular}[c]{@{}l@{}}0,1 euro\\0,1 euro \\0,2 euro \end{tabular} 
                          &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Nova & Rising Skull & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                         &\begin{tabular}[c]{@{}l@{}}0,3 euro\\0,5 euro \\0,8 euro \end{tabular} 
                         &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

 AK-47 &Redline & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                     &\begin{tabular}[c]{@{}l@{}}35 euro\\115 euro \\D.E euro \end{tabular} 
                     &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

PP-bizon & Osiris & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                       &\begin{tabular}[c]{@{}l@{}}0,5 euro\\1,4 euro \\2,8 euro \end{tabular} 
                       &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Scar-20 & Cyrex & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                     &\begin{tabular}[c]{@{}l@{}}2 euro\\4 euro \\8,3 euro \end{tabular} 
                     &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

SG 553 & Pulse & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                    &\begin{tabular}[c]{@{}l@{}}0,8 euro\\4,5 euro \\D.E \end{tabular} 
                    &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline 

Sawed-Off & HighWayMan & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                            &\begin{tabular}[c]{@{}l@{}}1,4 euro\\2,3 euro \\9,1 euro \end{tabular} 
                            &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline

Tec-9 & Isaac & ja &\begin{tabular}[c]{@{}l@{}}Field-Tested\\ Minimal-Wear\\Factory-New\end{tabular} 
                   &\begin{tabular}[c]{@{}l@{}}0,2 euro\\0,4 euro \\2,3 euro \end{tabular} 
                   &\raisebox{-\totalheight}{\includegraphics[scale=0.1]{Plot1}} \\ \hline


\end{longtable}
\end{document}

I get this + more on page 2 and 3. enter image description here

I want to have the picture at the top of the cell in the last column and likewise with the text in the first 3 column.

I use: \documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[danish]{babel} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{graphicx} \usepackage{enumerate} \usepackage{fancyhdr} \usepackage{lastpage} \usepackage{longtable} \usepackage{booktabs}

what to do?

  • \section*{\centerline {Co Ouch don't do that! (don't put formatting in a section title and don't use \centerline in latex. – David Carlisle Nov 14 '14 at 16:29
  • #Kurt i will remember that till next time. #David, what should i do then, to get the same effect? – Mikkel Holmbo Lund Nov 14 '14 at 21:11
  • 1
    \section*{Counter-Strike: Global Offensive} (apart from general markup clarity, you wouldn't want the \centerline in the table of contents. If section titles should be centred that is a choice of the document style: so set by the document class, or a simple redefinition in the preamble or a package such as secsty allows specification of heading format. – David Carlisle Nov 14 '14 at 21:17
3

enter image description here

You have used

\raisebox{-\totalheight}{\includegraphics

which moves the baseline of the picture to its top edge, so as you see in your image the top edge aligns with the baseline of the text in the l columns, such as AUG.

You want the baseline of the image to be roughly 15pt from the top of the image so

 \raisebox{\dimexpr15pt-\totalheight\relax}{\includegraphics

Then you have

  \begin{tabular}[c]{@{}l@{}}Fie

which forces the baseline of the table to be in its centre which is why there is so much space at the top of the other entries, use [t] so the baseline of the inner table is on its top row.

  • Thanks that did it, however I made a few changes, since 15 pt, was too much, and i found that it should be "dimexpr" i did this: \raisebox{\dimexpr8pt-\totalheight\relax}{\includegraphics[scale=0.1]{Plot1}} Thanks again. – Mikkel Holmbo Lund Nov 14 '14 at 20:56
  • 1
    @MikkelHolmboLund sorry about the typo, will fix, yes the offset for the image was a guess, glad you got it working – David Carlisle Nov 14 '14 at 20:59
2

I suggest the adjustbox package, which allows to use the valign=t option that's exactly what you want.

I suggest also some simplifications of your input, with macros that substitute the repetitive tasks.

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}

\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{longtable}
\usepackage{booktabs}

\newcommand{\splitcell}[2][c]{%
  \begin{tabular}[#1]{@{}l@{}}#2\end{tabular}%
}

\newcommand{\addplot}[2][]{%
  \includegraphics[
    % scale=0.1, % what you'll use
    width=3cm,height=3cm, % for this example
    valign=t,
    #1, % other possible options
  ]{#2}%
}


\begin{document}

\section*{Counter-Strike: Global Offensive}

Her finder du information om de forskellige skins du gerne vil have.
Tabellen med information er sidst opdateret den \today. \\

\begin{longtable}{|l|l|l|l|l|l|}
\hline\endhead
\hline\endfoot
Våben  &Navn på skin  &Stattrak  &Kvalitet &Pris &Billede \\ \hline

AUG       &Torque  &Ja  &\splitcell[t]{Field-Tested\\ Minimal - Wear\\Factory-New} 
                        &\splitcell[t]{1 euro\\1,6 euro \\2,4 euro}  
                        &\addplot{duck} \\ \hline

AWP       &Redline &Ja  &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New}
                        &\splitcell[t]{24 euro\\46 euro \\D.E }   
                        &\addplot{duck} \\ \hline

CZ75 Auto   &Tigris  &Ja  &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New}
                          &\splitcell[t]{2 euro\\4,5 euro \\13,7 euro} 
                          &\addplot{duck} \\ \hline

Desert eagle &Hypnotic &Ja    &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New}
                              &\splitcell[t]{D.E\\29 euro \\15,90 euro} 
                              &\addplot{duck} \\ \hline

Famas &Pulse &Ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New}
                 &\splitcell[t]{1,2 euro\\1,6 euro \\2,8 euro} 
                 &\addplot{duck} \\ \hline

Scout/SSG08 & Abyss &Ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New}
                        &\splitcell[t]{0,3 euro\\0,9euro \\4,4 euro} 
                        &\addplot{duck} \\ \hline

 Usp-S & Caiman &Ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                    &\splitcell[t]{6 euro\\11 euro \\15,2 euro} 
                    &\addplot{duck} \\ \hline

Five-Seven & Kami & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                       &\splitcell[t]{0,1 euro\\0,2 euro \\0,3 euro} 
                       &\addplot{duck} \\ \hline

G3SG1 & Azure Zebra & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                         &\splitcell[t]{0,2 euro\\0,2 euro \\0,3 euro} 
                         &\addplot{duck} \\ \hline

Galil AR & Blue Titanium & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                              &\splitcell[t]{D.E\\D.E\\0,6 euro} 
                              &\addplot{duck} \\ \hline

Glock-18 & Water Element & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                              &\splitcell[t]{16 euro\\24 euro \\38,1 euro} 
                              &\addplot{duck} \\ \hline

M4A1-S & Guardian & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                       &\splitcell[t]{20,1 euro\\28,2 euro \\39,7 euro} 
                       &\addplot{duck} \\ \hline

M4A4 & Bullet Rain & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                        &\splitcell[t]{22,4 euro\\33,7 euro \\66,8 euro} 
                        &\addplot{duck} \\ \hline

Mag 7 & Heaven Guard & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                          &\splitcell[t]{0,1 euro\\0,1 euro \\0,2 euro} 
                          &\addplot{duck} \\ \hline

Nova & Rising Skull & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                         &\splitcell[t]{0,3 euro\\0,5 euro \\0,8 euro} 
                         &\addplot{duck} \\ \hline

 AK-47 &Redline & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                     &\splitcell[t]{35 euro\\115 euro \\D.E euro} 
                     &\addplot{duck} \\ \hline

PP-bizon & Osiris & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                       &\splitcell[t]{0,5 euro\\1,4 euro \\2,8 euro} 
                       &\addplot{duck} \\ \hline

Scar-20 & Cyrex & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                     &\splitcell[t]{2 euro\\4 euro \\8,3 euro} 
                     &\addplot{duck} \\ \hline

SG 553 & Pulse & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                    &\splitcell[t]{0,8 euro\\4,5 euro \\D.E } 
                    &\addplot{duck} \\ \hline 

Sawed-Off & HighWayMan & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                            &\splitcell[t]{1,4 euro\\2,3 euro \\9,1 euro} 
                            &\addplot{duck} \\ \hline

Tec-9 & Isaac & ja &\splitcell[t]{Field-Tested\\ Minimal-Wear\\Factory-New} 
                   &\splitcell[t]{0,2 euro\\0,4 euro \\2,3 euro} 
                   &\addplot{duck} \\ \hline

\end{longtable}
\end{document}

Note that I left only the necessary packages. Top alignment of all cells seems best in this case.

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.