I am trying to have table exactly between margins using \textwidth. Unfortunately, when I am using \textwidth my table is too large and I do not know why. (my code is for django template, but I was checking it in TexStudio also).
I am trying to have such tables (note that 18cm is my \textwidth, as I have a4paper and both left and right margins = 1,5cm)
\begin{tabular}{|p{18cm}|}
\hline
aaa\\
\hline
\end{tabular}
\begin{tabular}{|p{.08\textwidth}|p{.08\textwidth}|p{.08\textwidth}|p{.08\textwidth}|p{.16\textwidth}|p{.2\textwidth}|p{.2\textwidth}|p{.12\textwidth}|}
\hline
PWM & O2 & CO & CO2 & Temp. spalin & Ciśni. gaz przed EV & Ciśn gazu ze EV & Prąd jon. \\ \hline
- & \% & ppm & \% & oC & mbar & mbar & microA \\ \hline
& & & & & & & \\ \hline
\end{tabular}
where all widths sum up to 1, but table is too wide (the same result was when I specified width in cm). In preamble I am using for whole document, but it doesn't matter if it is commented out or not :
\setlength{\parindent}{0cm}
All of the preamble :
\documentclass[8pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=1.50cm, right=1.50cm, top=1.50cm, bottom=1.50cm, width=18cm]{geometry}
\usepackage{showframe}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{titlesec}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\titleformat{\section}
{\normalfont\Large\bfseries\filcenter}{\thesection}
{0em}{}
% \usepackage{roboto}
% \usepackage[sfdefault, thin]{roboto}
\setlength{\parindent}{0cm}
\newcommand{\mySmallSkip}{\hspace*{10mm}}
\pagestyle{fancy}
%\usepackage{showframe}
\fancyhf{}
\renewcommand{\footrulewidth}{0.4pt}% default is 0pt
\textheight=160mm
\tabcolsep
and the width of the vertical lines. This is why your table is wider than the textwidth.l
type columns be sufficient? Your table would then be narrower than the textwidth.8pt
is not a valid option for thearticle
document class.