0

I have a big document only composed of tabular or tabularx (product specifications) and I would like to center them in the whole document. Those tabular are considerable, most of them use the full width availiable (in this case it's a basic portrait A4 paper), so 21cm.

Examples:

\begin{tabularx}{21cm}{X X X}
...
\end{tabularx}
\begin{tabularx}{15cm}{X X X}
...
\end{tabularx}
\begin{tabularx}{20.5cm}{X X X}
...
\end{tabularx}

When I started making all the tabulars, I realize that a tabular have a kind of margin around it and as the space is precious to me, I decide to remove all margins in the document. To do that, I use the command \setlength{\oddsidemargin}{-1.22in} (found here) which shift the whole content of the document a little bit to the left to compensate the tabular left margin.

But now, when I try to center all tabulars (because some of them are smaller) in the page using \centering or any other centering technic, there are not centered. They are in fact but with an additional 1.22in on the left, which is exactly the length specified in \setlength{\oddsidemargin}{-1.22in}.

If I comment %\setlength{\oddsidemargin}{-1.22in}, most of my tabulars exceed on the right and are then truncated (so some end of text are not displayed)

So I have severals questions at this point :

  • Did I wrongly remove the margin of my document ? Because here I am not removing them but compensating them in fact.

  • Is it possible to do without \setlength{\oddsidemargin}{-1.22in} to be able to use the \centering command in the correct way ?

  • If not, is there any way to disable or set to 0 the right margin (and not the padding like in HTML) of a tabular ?

Thanks,

Note 1 : I did not specified any \textwidth, all the original with \documentclass{article}[10pt,a4paper,sans]

Note 2 : I use those commands to remove margins and other stuff :

\setlength{\topmargin}{-1.4in}
\setlength{\oddsidemargin}{-1.22in}
\setlength{\marginparwidth}{0in}
\setlength{\hoffset}{0in}
\setlength{\voffset}{0in}
  • it is very hard to guess what you have done or what the outcome is, please post a single small but complete document that shows the problem, so people can debug it. – David Carlisle Feb 22 '18 at 21:18
  • setting the margin to be negative is rather weird (and quite hard to define what centering should then mean, but without a test document it is impossible to guess, in particular the main length affecting \centering is \textwidth and you have given no information about that. – David Carlisle Feb 22 '18 at 21:20
  • @DavidCarlisle I did not specified any \textwidth in the whole document, should I ? – user153088 Feb 22 '18 at 21:39
  • well since in most classes it will default to a value suitable for US letter paper then probably you need to change that but as you have just posted disjointed fragments it is really impossible to say. The images you have added to not clarify the question at all, you need to post a test document and the output from that document – David Carlisle Feb 22 '18 at 21:41
  • also you almost certainly don't want the table environment (and certainly not \begin{table}[h]) if your document just consists of tabulars, that makes it impossible to set the tables at all, so all the tables will be held in memory until the end of the document and then dumped as an emergency fallback output. – David Carlisle Feb 22 '18 at 21:44
0

A skeleton for a document with horizontally centered tables that might occupy the full text width would be:

\documentclass[a4paper]{article}
\usepackage[
  hmargin=0mm, % Remove left and right margin
  % Set vertical margin or whatever
]{geometry}
\usepackage{tabularx}

\setlength{\parindent}{0pt}% No indentation of first lines in paragraphs
\setlength{\parskip}{2ex minus 1ex plus 4ex}% Vertical space between paragraphs

\begin{document}
\centering

\begin{tabularx}{21cm}{X X X}
  ...
\end{tabularx}

\begin{tabularx}{15cm}{X X X}
  ...
\end{tabularx}

\begin{tabularx}{20.5cm}{X X X}
  ...
\end{tabularx}
\end{document}

The empty lines between the environments tabularx are important. Then each table is set inside a new paragraph. The space between these paragraphs can be configured by \parskip, see the preamble.

  • That was the perfect answer, It worked for me. Thanks a lot ! – user153088 Feb 22 '18 at 21:59
0

enter image description here

The markup for the table was over complicated and forcing many over full boxes, this version has no over or under full box warnings and so centres on the page.

\documentclass[10pt,a4paper,draft]{article}

\usepackage{array}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{wasysym}
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage[table]{xcolor}

\setlength{\topmargin}{-1.4in}
\setlength{\oddsidemargin}{-1in}
\setlength{\marginparwidth}{0in}
\setlength\textwidth{\paperwidth}

\begin{document}
\centering



\begin{tabular}{@{}ccc@{}}
\large\textbf{Neurologique}&
\large\textbf{Ventilatoire}&
\large\textbf{Circulatoire}\\
\begin{tabular}{l r l}
\multirowcell{3}{Pupilles\\\underline{NRS}}&\underline{n}ormales&Oui / Non\\
&\underline{r}\'{e}actives&Oui / Non\\
&\underline{s}ym\'{e}triques&Oui / Non\\
\multirowcell{2}{Rep\`{e}re\\\underline{OST}}&\underline{t}emps&Oui / Non\\
&\underline{e}space&Oui / Non\\
\multirowcell{6}{Motricit\'{e}\\\underline{MS4M}}&main G&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&main D&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&pied G&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&pied D&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&doigt Sym.&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&pieds Sym.&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
\end{tabular}&
\begin{tabular}{l r l}
Chaleur&temp\'{e}rature&\raisebox{-0.4mm}{\rule{1cm}{0.1mm}}\raisebox{4px}{\begin{math}\circ\end{math}}C\\
Saturation&SpO\textsubscript{2} (\begin{math}\geq\end{math}94)&\raisebox{-0.4mm}{\rule{1cm}{0.1mm}}\%\\
\multirowcell{3}{Fr\'{e}quence\\Ventilatoire\\\underline{ARS}}&\underline{a}mple&Oui / Non\\
&\underline{r}\'{e}guli\`{e}re&Oui / Non\\
&\underline{s}ym\'{e}trique&Oui / Non\\
\multirowcell{3}{Respiration\\\underline{A--Normale}}&gasps&Oui / Non\\
&sifflements&Oui / Non\\
&ronflements&Oui / Non\\
Fr\'{e}quence&respiratoire&\raisebox{-0.4mm}{\rule{8mm}{0.1mm}}mpm\\
\textbf{Enfant}&\textbf{Ado}&\textbf{Adulte}\\
30--60&30--20&20--12
\end{tabular}&
\begin{tabular}{l r l}
TRC&recoloration&\raisebox{1px}{\begin{math}<\end{math}}3s / \begin{math}\geq\end{math}3s\\
\multirowcell{4}{Tension\\art\'{e}rielle}&mesure sur&Hum. / Carot.\\
&gauche&\raisebox{-0.4mm}{\rule{8mm}{0.1mm}} / \raisebox{-0.4mm}{\rule{8mm}{0.1mm}}\\
&droite&\raisebox{-0.4mm}{\rule{8mm}{0.1mm}} / \raisebox{-0.4mm}{\rule{8mm}{0.1mm}}\\
&r\'{e}f\'{e}rence&\raisebox{-0.4mm}{\rule{8mm}{0.1mm}} / \raisebox{-0.4mm}{\rule{8mm}{0.1mm}}\\
\multirowcell{3}{Pouls\\\underline{RBFS}}&\underline{r}\'{e}gulier&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&\underline{b}ien \underline{f}rapp\'{e}&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
&\underline{s}ym\'{e}trique&OK\,/\,\begin{math}\approx\end{math}\,/\,KO\\
Fr\'{e}quence&cardiaque&\raisebox{-0.4mm}{\rule{13mm}{0.1mm}}bpm\\
\textbf{Enfant}&\textbf{Ado}&\textbf{Adulte}\\
100--160&70--140&60--100
\end{tabular}
\end{tabular}

\vspace{5mm}

\begin{tabular}{r l c c l c c l c c l}
\multicolumn{11}{c}{\large{\textbf{Bilan d'examen compl\'{e}mentaire}}}\\
Refus de:&s'allonger / s'assoir&\quad\,\quad&\framebox(10, 10)&Sueurs&\quad\,\quad&\framebox(10, 10)&Pacemaker&\quad\,\quad&\framebox(10, 10)&Veines apparentes\\
\'Etat:&anxieux(e) / stress\'{e}(e)&\quad\,\quad&\framebox(10, 10)&P\^{a}leurs&\quad\,\quad&\framebox(10, 10)&Muqueuses&\quad\,\quad&\framebox(10, 10)&Extr\^{e}mit\'{e}s froides\\
Sensation:&froid / chaud&\quad\,\quad&\framebox(10, 10)&Cloques&\quad\,\quad&\framebox(10, 10)&Maux de t\^{e}te&\quad\,\quad&\framebox(10, 10)&Fatigue g\'{e}n\'{e}ralis\'{e}e\\
Sensation:&soif / transpiration&\quad\,\quad&\framebox(10, 10)&Angoisse&\quad\,\quad&\framebox(10, 10)&Conjonctivite&\quad\,\quad&\framebox(10, 10)&Insectes implant\'{e}es\\
Sensation:&de vide / d\'{e}s\'{e}quilibre&\quad\,\quad&\framebox(10, 10)&Cyanoses&\quad\,\quad&\framebox(10, 10)&L\`{e}vres jers\'{e}es&\quad\,\quad&\framebox(10, 10)&Mycoses aux ongles\\
Difficult\'{e}s \`{a}:&parler / bouger&\quad\,\quad&\framebox(10, 10)&Marbrures&\quad\,\quad&\framebox(10, 10)&Fourmillements&\quad\,\quad&\framebox(10, 10)&Odeur forte d'alcool\\
Paralysie:&gauche / droite&\quad\,\quad&\framebox(10, 10)&Somnolent&\quad\,\quad&\framebox(10, 10)&Traces de piq\^{u}res&\quad\,\quad&\framebox(10, 10)&Envie de vomissements\\
\end{tabular}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy