This is my code, i don't know how to write a tabel on my own yet, so i used an online maker to do this, how do i make sure that the table won't go over my textwidth?

                                          & \textbf{Fremstilling}                                                                                         & \textbf{Brug}                                                                                                                         & \multicolumn{1}{c}{\textbf{Bortskaffelse}}                                                                        \\ \hline
\multicolumn{1}{|c|}{\textbf{Materiale}}  & \multicolumn{1}{|c|}{Stål (9,95kg)}                                                                           & \multicolumn{1}{|c|}{Energiforbrug til mekanisme}                                                                                     & \multicolumn{1}{|l|}{Energiforbrug til omsmeltning}                                                               \\ \hline
\multicolumn{1}{|c|}{\textbf{Energi}}     & \multicolumn{1}{|c|}{3133,16MJ}                                                                               & \multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Nok energi til at trække 26.2N hver\\   gang, at anordningen aktiveres.\end{tabular}} & \multicolumn{1}{|l|}{846,8MJ}                                                                                     \\ \hline
\multicolumn{1}{|c|}{\textbf{Kemikalier}} & \multicolumn{1}{|c|}{-}                                                                                       & \multicolumn{1}{|c|}{Eventuel smørelse}                                                                                               & \multicolumn{1}{|l|}{-}                                                                                           \\ \hline
\multicolumn{1}{|c|}{\textbf{Andet}}      & \multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Slibning, eventuel galvanisering\\   (rustfrit)\end{tabular}} & \multicolumn{1}{|c|}{Vedligeholdelse, udskiftning af pigge}                                                                           & \multicolumn{1}{|l|}{\begin{tabular}[c]{@{}c@{}}Genanvendelse af stål (10MJ/kg til\\   omsmeltning)\end{tabular}} \\ \hline
  • 2
    Generally, it is up to you to make sure your table does not extend into the right margin. If it has that tendency, you can either reorganize your data presentation to avoid it, or you can, as a last resort, shrink the whole table to fit. But the latter solution will shrink your table fontsize, as well. Commented Dec 5, 2013 at 13:12

1 Answer 1


Here's one possibility:

\usepackage[margin=3cm]{geometry} % set margins smaller (YMMV)
\usepackage{lmodern} % for unicode support
\usepackage{booktabs} % for publication-quality tables
\usepackage{tabularx} % for column width balancing
\usepackage{siunitx} % for typesetting physical quantities with units
\sisetup{% setup for your locale (Denmark)
  output-decimal-marker = {,},
  per-mode = symbol,

 & \textbf{Fremstilling}
  & \textbf{Brug}
  & \textbf{Bortskaffelse}                                                    \\
Materiale & Stål (\SI{9,95}{\kilo\gram})
  & Energiforbrug til mekanisme
  & Energiforbrug til omsmeltning                                             \\
Energi & \SI{3133,16}{\mega\joule}
  & Nok energi til at tr\ae{}kke \SI{26.2}{\newton} hver gang, at anordningen aktiveres.
  & \SI{846,8}{\mega\joule}                                                   \\
Kemikalier & -
  & Eventuel sm\o{}relse
  & -                                                                         \\
Andet & Slibning, eventuel galvanisering (rustfrit)
  & Vedligeholdelse, udskiftning af pigge
  & Genanvendelse af stål (\SI{10}{\mega\joule\per\kilo\gram} til omsmeltning)\\

enter image description here

I used booktabs for more professional-looking rules and layout, tabularx to set the table as wide as the text and distribute column widths, wrapping text where appropriate, and siunitx for typesetting physical quantities with units.

The \addlinespace commands are optional; I thought the extra space provided helped separate the rows a bit better, but others may have different opinions. Typically, I would use \addlinespace just once or twice in a table to highlight/set off a specific row(s).

  • 1
    The input code features the character ø, but the screenshot seems to show \emptyset; probably not the intended result, right?
    – Mico
    Commented Jan 27, 2015 at 6:22
  • @Mico thanks for catching that; I thought I had fixed all of those. I'm not used to all these "weird" languages... ;-) Commented Jan 27, 2015 at 9:40

You must log in to answer this question.

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