[Tex/LaTex] tabu to textwidth yields a table wider than textwidth

tablestabuwidth

I have a code for a table that should fit to textwidth, but for some reason it doesn't. Any ideas why?

\documentclass {article}

\usepackage [T2A] {fontenc}
\usepackage [utf8] {inputenc}
\usepackage [english,russian] {babel}

\usepackage{longtable}
\usepackage{array}
\usepackage{tabu}

\usepackage{lipsum}

\begin{document}

    \lipsum[1-1]
    \tabulinesep = 1mm
    \begin{longtabu} to \textwidth {|c|X[p]|c|c|c|c|c|}
        \hline
        & 
        & \multicolumn{5}{c|}{\bfseries Количество часов} \\ \cline{3-7}
        %
    \bfseries
    \begin{tabular}{c}
        № \\ модуля 
    \end{tabular}
        & \centering\bfseries Наименование модулей
        & \bfseries Всего
        & \multicolumn{3}{c|}{\bfseries%
            \begin{tabular}{c}
            Аудиторная \\ работа 
            \end{tabular}}
        & \bfseries
            \begin{tabular}{c}
            Внеауд. \\ работа \\ СР
            \end{tabular} \\ \cline{4-6}
    &
        &
        & \bfseries Л
        & \bfseries ПЗ
        & \bfseries ЛР
        & 
        \\ \hline
    \end{longtabu}
    \noindent\hrulefill
\end{document}

Too wide table

Best Answer

I'm not sure why (tabu is somewhat surprising, usually), but specifying the inner tabular environments with @{}c@{} instead of c seems to cure the problem.

\documentclass {article}

\usepackage [T2A] {fontenc}
\usepackage [utf8] {inputenc}
\usepackage [english,russian] {babel}

\usepackage{longtable}
\usepackage{array}
\usepackage{tabu}

\usepackage{lipsum}

\begin{document}

    \lipsum[1-1]
    \tabulinesep = 1mm
    \begin{longtabu} to \textwidth {|c|X[p]|c|c|c|c|c|}
        \hline
        & 
        & \multicolumn{5}{c|}{\bfseries Количество часов} \\ \cline{3-7}
        %
    \bfseries
    \begin{tabular}{@{}c@{}}
        № \\ модуля 
    \end{tabular}
        & \centering\bfseries Наименование модулей
        & \bfseries Всего
        & \multicolumn{3}{c|}{\bfseries%
            \begin{tabular}{@{}c@{}}
            Аудиторная \\ работа 
            \end{tabular}}
        & \bfseries
            \begin{tabular}{@{}c@{}}
            Внеауд. \\ работа \\ СР
            \end{tabular} \\ \cline{4-6}
    &
        &
        & \bfseries Л
        & \bfseries ПЗ
        & \bfseries ЛР
        & 
        \\ \hline
    \end{longtabu}
\end{document}

enter image description here