1

Using \centering or the table environment doesn't seem to change the text inside the tabular. It shouldn't be a problem the graphics with tikz or the microtype.

How can they be centered without the left margin (using up all the page horizontal space) ?

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amsmath,amssymb}
\usepackage{listingsutf8}
\usepackage{blindtext}
\usepackage[inline]{enumitem}
\usepackage{tabularx}
\usepackage{microtype}

\usepackage{tikz}
\usetikzlibrary{calc}

\setlist[itemize]{topsep=0pt,after=\newline}

\hyphenpenalty=10000
\exhyphenpenalty=10000

\newcommand{\tableau}[1]{{\sffamily #1}}
\newcommand\tab[1][0.75cm]{\hspace*{#1}}


\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\newcommand*{\DrawArrow}[3][]{%
% #1 = draw options
% #2 = left point
% #3 = right point
\begin{tikzpicture}[overlay,remember picture]
\draw [thick, -stealth, #1] ($(#2)+(0.35em,-0.5ex)$) to ($(#3)+(0.25em,-0.5ex)$);
\end{tikzpicture}%
}%

\begin{document}
\blindtext

\begin{enumerate}[
leftmargin=0pt,
itemindent=15pt,
listparindent=0.7cm,
labelwidth=15pt,
itemsep=10pt,
parsep=7.5pt,
]
\item {\sffamily acgaccccaa}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{4}{c}}
        \$ & a & c & g\\
        \{10\} & \{0,3,8,9\} & \{\tikzmark{1}1,4,5,6,7\} & \{\tikzmark{2}2\}            
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{2}{1}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{5}{c}}
        \$ & a & c & cg & g\\
        \{10\} & \{\tikzmark{0}0,3,8,9\} & \{4,5,6,7\} & \{\tikzmark{1}1\} & \underline{\{2\}}          
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{1}{0}

\vspace{0.5cm}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{6}{c}}
        \$ & a & acg & c & cg & g\\
        \{10\} & \{\tikzmark{3}3,8,9\} & \{0\} & \{\tikzmark{4}4,\tikzmark{5}5,\tikzmark{6}6,\tikzmark{7}7\} & \underline{\{1\}} & \underline{\{2\}}            
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{4}{3}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{5}{3}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{6}{3}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{7}{3}

\vspace{0.5cm}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{7}{c}}
        \$ & a & acccc & acg & c & cg & g\\
        \underline{\{10\}} & \underline{\{8,9\}} & \underline{\{3\}} & \underline{\{0\}} & \underline{\{4,5,6,7\}} & \underline{\{1\}} & \underline{\{2\}}          
    \end{tabular*}
}

\item {\sffamily aeeeaaeabceeedee}


\textls[120]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{6}{c}}
        \$ & a & b & c & d & e\\
        \{16\} & \{\tikzmark{0}0,4,\tikzmark{5}5,7\} & \{8\} & \{\tikzmark{9}9\} & \{\tikzmark{13}13\} & \{\tikzmark{1}1,\tikzmark{2}2,\tikzmark{3}3,\tikzmark{6}6,\tikzmark{10}10,\tikzmark{11}11,\tikzmark{12}12,\tikzmark{14}14,\tikzmark{15}15\}
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{1}{0}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{2}{0}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{3}{0}
\DrawArrow[blue,out=-90, in=-90, bend right = -18]{6}{5}
\DrawArrow[blue,out=-90, in=-90, bend right = -39]{10}{9}
\DrawArrow[blue,out=-90, in=-90, bend right = -39]{11}{9}
\DrawArrow[blue,out=-90, in=-90, bend right = -39]{12}{9}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{14}{13}
\DrawArrow[blue,out=-90, in=-90, bend right = -30]{15}{13}

\vspace{1.5cm}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{8}{c}}
        \$ & a & ae & aeee & b & ceee & dee & e\\
        \{16\} & \{4,7\} & \{6\} & \{0\} & \{8\} & \{\tikzmark{9}9\} & \{\tikzmark{13}13\} & \underline{\{1,2,3,6,10,11,12,14,15\}}
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{13}{9}


\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{8}{c}}
        \$ & a & ae & aeee & b & ceeedee & dee & e\\
        \{16\} & \{4,7\} & \{6\} & \{0\} & \{\tikzmark{8}8\} & \{\tikzmark{9}9\} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{9}{8}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{8}{c}}
        \$ & a & ae & aeee & bceeedee & ceeedee & dee & e\\
        \{16\} & \{4,\tikzmark{7}7\} & \{6\} & \{0\} & \{\tikzmark{8}8\} & \underline{\{9\}} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
    \end{tabular*}
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{8}{7}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{8}{c}}
        \$ & abceeedee & ae & aeee & bceeedee & ceeedee & dee & e\\
        \{16\} & \{\tikzmark{4}4,7\} & \{\tikzmark{6}6\} & \underline{\{0\}} & \underline{\{8\}} & \underline{\{9\}} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
    \end{tabular*}  
}

\DrawArrow[blue,out=-90, in=-90, bend right = -30]{6}{4}

\textls[80]{
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{9}{c}}
        \$ & abceeedee & abceeedeeae & ae & aeee & bceeedee & ceeedee & dee & e\\
        \underline{\{16\}} & \underline{\{7\}} & \underline{\{4\}} & \underline{\{6\}} & \underline{\{0\}} & \underline{\{8\}} & \underline{\{9\}} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
    \end{tabular*}
}

\end{enumerate}
\end{document}

Here are the result: I would like the tabular to be centered along the page.

Imgur

What I would like to see is that each tabular align center with the page, without the left margin, a true center of all the table to the page.

The 2 to 3 last tables are wider than \textwidth, so they won't align well.

0

2 Answers 2

2

There are paragraph indents and unwanted spaces. Adding \noindent and commenting line ends helps. Also, \linewidth is the current line width that is set by other environments like enumerate, quote, ...

\noindent
\textls[80]{%
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}*{4}{c}}
        \$ & a & c & g\\
        \{10\} & \{0,3,8,9\} & \{\tikzmark{1}1,4,5,6,7\} & \{\tikzmark{2}2\}
    \end{tabular*}%
}

The remaining overfull \hbox warnings are cases, where the width of the table is much too large. Switch to landscape or redesign the layout.

1
  • I'm thinking of redesigning the layout to make the margins bigger
    – Kazh
    Commented May 4, 2018 at 12:56
1

I found a solution: instead of tabular*, tabular is sufficient, and with makebox and the center environment, it does the centering I wanted.

\begin{center}

    \makebox[\textwidth][c]{
        \textls[80]{
        \begin{tabular}{*{8}{c}}
            \$ & abceeedee & ae & aeee & bceeedee & ceeedee & dee & e\\
            \{16\} & \{\tikzmark{4}4,7\} & \{\tikzmark{6}6\} & \underline{\{0\}} & \underline{\{8\}} & \underline{\{9\}} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
        \end{tabular}   
        }
    }

   \DrawArrow[blue,out=-90, in=-90, bend right = -30]{6}{4}

    \makebox[\textwidth][c]{
        \textls[80]{%
            \begin{tabular}{*{9}{c}}
            \$ & abceeedee & abceeedeeae & ae & aeee & bceeedee & ceeedee & dee & e\\
            \underline{\{16\}} & \underline{\{7\}} & \underline{\{4\}} & \underline{\{6\}} & \underline{\{0\}} & \underline{\{8\}} & \underline{\{9\}} & \underline{\{13\}} & \underline{\{1,2,3,6,10,11,12,14,15\}}
        \end{tabular}%
        }
    }

\end{center}

centering adjust

You must log in to answer this question.

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