1

Is it in any way possible to make a caption right under my table? I've tried \caption{table 1}, but that does not work, nothing changes.

And how do I get the text aligned to the left in the column?

Here is my code:

\begin{center}
    \begin{tabular}{| c || c | c | c | c | c | c |}
    \hline
    \thead{\makecell{Ønskede\\ egenskaber}} & \thead{Holdbarhed} & \thead{Pris} & \thead{\makecell{Billigt\\ og nemt}} & \thead{Miljøvenligt} & \thead{Udseende} &  \\ 
    \hline \hline
    \textbf{\makecell{Vægtning\\ (V) 1 - 5 \\ \fontsize{0}{.}}} & 4 & 3 & 5 & 3 & 2 & \textbf{\makecell{Sum\\ (P$\cdot$V)}} \\ 
    \hline
    \textbf{\makecell{Energibar\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{3 \\ \\ \textbf{12}} & \makecell{4\\ \\ \textbf{12}} & \makecell{2\\ \\ \textbf{10}} & \makecell{3\\ \\ \textbf{9}} & \makecell{4\\ \\ \textbf{8}} & \makecell{\\ \\ \textbf{51}} \\ 
    \hline
    \textbf{\makecell{Fitnessapparat\\ med display\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{\\ 5\\ \\ \textbf{20}} & \makecell{\\ 4 \\ \\ \textbf{12}} & \makecell{\\ 5 \\ \\ \textbf{25}} & \makecell{\\ 4\\ \\ \textbf{12}} & \makecell{\\ 2\\ \\ \textbf{4}} & \makecell{\\ \\ \\ \textbf{73}} \\
    \hline
    \textbf{\makecell{Vindmølle\\ med solceller\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{\\ 3\\ \\ \textbf{12}} & \makecell{\\ 1\\ \\ \textbf{3}} & \makecell{\\ 2\\ \\ \textbf{10}} & \makecell{\\ 5\\ \\ \textbf{15}} & \makecell{\\ 3\\ \\ \textbf{9}} & \makecell{\\ \\ \\ \textbf{49}} \\
    \hline
    \end{tabular}
\caption{Tabel 1}
\end{center}    
  • 4
    Please always post a complete document. By default captions are not "moved" at all they go under or over the table depending whether you put the \caption before or after the tabular. But some document classes and packages redefine \caption to position according to a document property. So the answer depends on information you have not given as to your setup. your columns are centered as you use c c... use l fro any column thatyou want left aligned – David Carlisle May 10 '14 at 12:06
  • Would you post a minimal working example? Unless you're using a package/class that manages caption positioning. Normally, if you call the \caption command after the tabular environment, the caption will be under the table. – Bernard May 10 '14 at 12:06
  • What is the intended behaviour from \fontsize{0}{.} It would generate a syntax error at the next font selection as . is not a legal length, but what do you want a font size of 0pt to do, it would make invisible text? – David Carlisle May 10 '14 at 12:10
  • 1
    Typographical pointer: Normally captions for tables are placed above them and captions for figures are placed under them. – Svend Tveskæg May 10 '14 at 12:12
  • David and Bernad, none of those things work. Using "l" instead of "c" makes no difference and neither does the \caption whether if I place it above "\begin{tabular}" or below "end{tabular}". But I think it has something to do the "\makecell" command. – RandomDude May 10 '14 at 12:14
4

Something like this. Here caption package is used. You can adjust skip=xx to suit your need.

To have text aligned to the left, use \makecell[l,r,b]{content} for left, right or bottom alignment.

enter image description here

Update:

Code

\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.5cm,papersize={15cm,15cm}]{geometry}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[T1]{fontenc}   
\usepackage[utf8]{inputenc}     
\usepackage{makecell,interfaces-makecell}
\usepackage[font=small,skip=0pt]{caption}
\begin{document}
\begin{table}
\centering
    \begin{tabular}{| c || c | c | c | c | c | c |}
    \hline
    \thead{\makecell{Ønskede\\ egenskaber}} & \thead{Holdbarhed} & \thead{Pris} & \thead{\makecell[l]{Billigt\\ og nemt}} & \thead{Miljøvenligt} & \thead{Udseende} &  \\ 
    \hline \hline
    \textbf{\makecell[l]{Vægtning\\ (V) 1 - 5 \\ \fontsize{0}{.}}} & 4 & 3 & 5 & 3 & 2 & \textbf{\makecell{Sum\\ (P$\cdot$V)}} \\ 
    \hline
    \textbf{\makecell[l]{Energibar\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{3 \\ \\ \textbf{12}} & \makecell{4\\ \\ \textbf{12}} & \makecell{2\\ \\ \textbf{10}} & \makecell{3\\ \\ \textbf{9}} & \makecell{4\\ \\ \textbf{8}} & \makecell{\\ \\ \textbf{51}} \\ 
    \hline
    \textbf{\makecell[l]{Fitnessapparat\\ med display\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{\\ 5\\ \\ \textbf{20}} & \makecell{\\ 4 \\ \\ \textbf{12}} & \makecell{\\ 5 \\ \\ \textbf{25}} & \makecell{\\ 4\\ \\ \textbf{12}} & \makecell{\\ 2\\ \\ \textbf{4}} & \makecell{\\ \\ \\ \textbf{73}} \\
    \hline
    \textbf{\makecell[l]{Vindmølle\\ med solceller\\ (P) 1 - 5\\ \\ P$\cdot$V \\ \fontsize{0}{.}}} & \makecell{\\ 3\\ \\ \textbf{12}} & \makecell{\\ 1\\ \\ \textbf{3}} & \makecell{\\ 2\\ \\ \textbf{10}} & \makecell{\\ 5\\ \\ \textbf{15}} & \makecell{\\ 3\\ \\ \textbf{9}} & \makecell{\\ \\ \\ \textbf{49}} \\
\hline
\end{tabular}
\caption{Tabel 1}
\end{table}
\end{document}
  • Don't use the center environment inside table; a simple \centering declaration is better, for it doesn't add extra vertical space. – egreg May 10 '14 at 16:39
  • Agreed and corrected accordingly, thanks for reminding. – Jesse May 10 '14 at 16:52
  • You should probably also add the instructions \usepackage[T1]{fontenc} and \usepackage[utf8]{inputenc} so that characters such as ø and æ will get typeset correctly. – Mico May 10 '14 at 17:11
  • @Mico, egreg -- Many thanks for the helping hands. – Jesse May 10 '14 at 17:20
  • You are sure bent on ending that document! – 1010011010 May 10 '14 at 17:24

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.