Graphics, Figures & TablesUsing KOMA Script to insert table that's too wide

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
calvoutn
Posts: 1
Joined: Wed May 18, 2022 5:30 pm

Using KOMA Script to insert table that's too wide

Post by calvoutn »

Hi! I'm trying to create a table (it's the format required for this), what's too wide to fit in a A4 page. I've tried putting in landscape and it doesn't fit either. What I'm trying is to use KOMA Script to insert an A3 page for the table, but it doesn't reposition the header or the page itself.

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{lipsum}
\usepackage{multicol} % Permite escribir en dos columnas.
\usepackage[spanish]{babel}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage[paper=A4,pagesize]{typearea}
\usepackage{pdflscape}
\usepackage{bigstrut}
%--------------------------------------------------
%Para agregar citas en apa
%Para citar se usa el comando \cite{}
%Las referencias se modifican en el archivo sample.bib
\usepackage{apacite}
%----------------------------------------------
%%%%%%%% Estilo de footers and headers %%%%%%%%%
\usepackage{fancyhdr} %Headers y footers
\pagestyle{fancy}
\fancyhf{}
\rhead{\textbf{Alumno: My name}}
\lhead{\textbf{Instalaciones sanitarias}}
\rfoot{Página \thepage}
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\huge\bfseries}{\thechapter.}{1em}{\Huge}
\titlespacing*{\chapter}{0pt}{-19pt}{0pt}
\begin{document}
%-------------------------------------------------------------------------------
% Portada
%-------------------------------------------------------------------------------
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I tried to read a bit on it, but I couldn't go further than that.
Any help is apprecitated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

tornado
Posts: 3
Joined: Fri May 13, 2022 8:37 am

Using KOMA Script to insert table that's too wide

Post by tornado »

You could use the

Code: Select all

adjustbox
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
package to wrap your table in and resize it to a smaller size that fits your page width.
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Using KOMA Script to insert table that's too wide

Post by MjK »

calvoutn wrote:Hi! I'm trying to create a table (it's the format required for this), what's too wide to fit in a A4 page. I've tried putting in landscape and it doesn't fit either. What I'm trying is to use KOMA Script to insert an A3 page for the table, but it doesn't reposition the header or the page itself.
In your example you are using fancyhdr and so this package is responsible for the width of the header (and footer). So if you want to adapt fancyhdr's \headwidth with every change of the typing area, you shoult tell it fancyhdr. You can do this automatically using typearea's \AfterCalculatingTypearea. See the KOMA-Script manual for more information about this command.

And the page itself is also repositioned by typearea. But you are telling typearea that is should use the last used DIV value which is obviously not, what you want. So either set another DIV like here:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}% Note: Note needed since April 2018 release of LaTeX
\usepackage{graphicx}
\usepackage{lscape}% Note: Also loaded by pdflscape below.
\usepackage{lipsum}
\usepackage{multicol} % Permite escribir en dos columnas. Note: Provides mix of differenc column numbers on the same page not only two colums like class option twocolumn
\usepackage[spanish]{babel}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage[paper=A4,pagesize]{typearea}
\AfterCalculatingTypearea{\setlength{\headwidth}{\textwidth}}% Note: Change fancyhdr's page head width with every recalculation of the typing area and margins.
\usepackage{pdflscape}% Note: Could be improved by loading scrhack.
\usepackage{bigstrut}
%--------------------------------------------------
%Para agregar citas en apa
%Para citar se usa el comando \cite{}
%Las referencias se modifican en el archivo sample.bib
\usepackage{apacite}
%----------------------------------------------
%%%%%%%% Estilo de footers and headers %%%%%%%%%
\usepackage{fancyhdr} %Headers y footers
\pagestyle{fancy}
\fancyhf{}
\rhead{\textbf{Alumno: My name}}
\lhead{\textbf{Instalaciones sanitarias}}
\rfoot{Página \thepage}
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\huge\bfseries}{\thechapter.}{1em}{\Huge}
\titlespacing*{\chapter}{0pt}{-19pt}{0pt}
\begin{document}
%-------------------------------------------------------------------------------
% Portada
%-------------------------------------------------------------------------------
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
But I would recommend to use solution from section 20.2 of the KOMA-Script manual.

Note: Usually combining typearea with scrlayer-scrpage would be easier than fancyhdr. But depending on your setting you may also need to change the header width and alignment after changing the paper size, width of the typing area or the margins.
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
Post Reply