0

I am always getting the same error and can't find a solution. I want to create a table in text width. The first and the second column should be centered and the third column is for text until the end of the line. How can I achieve this without an error?

\documentclass{scrartcl}                        
\usepackage{tabularx}                               
\usepackage{booktabs}                               
\usepackage{ragged2e}                               
\usepackage{siunitx}    
\usepackage{showframe}

\begin{document}
    \begin{tabularx}{\textwidth}{@{}cc>{\RaggedRight\arraybackslash}X}
        \toprule
        \footnotesize\textbf{Symbol} & \footnotesize\textbf{Einheit} & 
\footnotesize\textbf{Definition}\\
        \midrule
        $A$ & \si{\metre\squared} & Fläche\\
        $F$ & \si{N} & Kraft\\
        $D$ & \si{1} & Divergenz\\
        \bottomrule
    \end{tabularx}
\end{document}
1
  • 2
    Try \noindent before \begin{tabular}
    – CarLaTeX
    Sep 15, 2019 at 18:39

1 Answer 1

0

I think you noticed, that the left space between table and frame has the same length as the overfull thing.

So there are to possibilities to avoid that. The first one is to use an table environment. The code will look like that:

\documentclass{scrartcl}                        
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{siunitx}    
\usepackage{showframe}

\begin{document}
    \begin{table}
        \begin{tabularx}{\linewidth}{ccX}
            \toprule
            \footnotesize\textbf{Symbol} & \footnotesize\textbf{Einheit} & 
            \footnotesize\textbf{Definition}\\
            \midrule
            $A$ & \si{\metre\squared} & Fläche\\
            $F$ & \si{N} & Kraft\\
            $D$ & \si{1} & Divergenz\\
            \bottomrule
        \end{tabularx}
    \end{table}
\end{document}

The seccond one is, to use the flushleft environment:

\documentclass{scrartcl}                        
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{siunitx}    
\usepackage{showframe}

\begin{document}
    \begin{flushleft}
        \begin{tabularx}{\linewidth}{ccX}
            \toprule
            \footnotesize\textbf{Symbol} & \footnotesize\textbf{Einheit} & 
            \footnotesize\textbf{Definition}\\
            \midrule
            $A$ & \si{\metre\squared} & Fläche\\
            $F$ & \si{N} & Kraft\\
            $D$ & \si{1} & Divergenz\\
            \bottomrule
        \end{tabularx}
    \end{flushleft}
\end{document}
1
  • thank you very much! works like a charm
    – Bolle
    Sep 15, 2019 at 20:54

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.