Невозможно одновременно использовать makecell, threeparttable и tabulary

Невозможно одновременно использовать makecell, threeparttable и tabulary

Я пытаюсь достичь "threeparttables", одновременно используя и то, и другое makecell(для достижения разрывов строк внутри ячеек) и tabulary(чтобы таблицы не превышали \linewidth). Но хотя я могу достичь threeparttables с tabularyэтим don't use makecell(первый пример кода ниже) и таблиц с tabularyэтим use makecellbut not threeparttable(второй пример кода ниже), я не могу создать документ, который объединяет три (третий пример). Что делать?

Я знаю, что использование tabularxвместо tabularyсоздает эту конкретную таблицу, но у меня много таких таблиц. Я бы предпочел не проверять каждую таблицу отдельно, а вместо этого использовать tabulary. Кроме того, я не женат на использовании, makecellно мне нужно иметь возможность иметь разрывы строк внутри ячеек (и контролировать их вертикальное выравнивание).

Любая помощь приветствуется!

Первый пример( threeparttableи tabularно нет makecell)

\documentclass{article}
\usepackage[para]{threeparttable}
\usepackage{tabulary}
\begin{document}
  \begin{table}
    \begin{threeparttable}
      \caption{Lorem ipsum dolor sit amet, consectetur}

      {
        \begin{tabulary}{\linewidth}{L r L r}
        \textbf{Aaa} & \textbf{Bbb} & \textbf{Ccc} \tabularnewline
         & & Ccc1 & Ccc2 \tabularnewline
        Adipisicing elit, sed do eiusmod tempor & \(0.40\) & Ut labore et dolore magna aliqua & \(7.77\) \tabularnewline
        Ut enim ad minim veniam, quis nostrud exercitation & \(0.93\) & Ullamco laboris nisi ut aliquip ex ea commodo consequat & \(62.6\) \tabularnewline
        \end{tabulary}
      }
    \end{tablenotes}
  \end{threeparttable}
\end{document}

Второй пример( tabularyи makecellно нетthreeparttable

\documentclass{article}
\usepackage{tabulary}
\usepackage{makecell}
\begin{document}
  \begin{table}
    \caption{Lorem ipsum dolor sit amet, consectetur}

    {
      \begin{tabulary}{\linewidth}{L r L r}
      \textbf{Aaa} & \textbf{Bbb} & \textbf{Ccc} \tabularnewline
       & & \makecell{Ccc1} & \makecell{Ccc2 \\ Ccc2} \tabularnewline
      Adipisicing elit, sed do eiusmod tempor & \(0.40\) & Ut labore et dolore magna aliqua & \(7.77\) \tabularnewline
      Ut enim ad minim veniam, quis nostrud exercitation & \(0.93\) & Ullamco laboris nisi ut aliquip ex ea commodo consequat & \(62.6\) \tabularnewline
      \end{tabulary}
    }
  \end{table}
\end{document}

Третий пример(все три не работают)

\documentclass{article}
\usepackage[para]{threeparttable}
\usepackage{tabulary}
\usepackage{makecell}
\begin{document}
  \begin{table}
    \begin{threeparttable}
      \caption{Lorem ipsum dolor sit amet, consectetur}

      {
        \begin{tabulary}{\linewidth}{L r L r}
        \textbf{Aaa} & \textbf{Bbb} & \textbf{Ccc} \tabularnewline
         & & \makecell{Ccc1} & \makecell{Ccc2 \\ Ccc2} \tabularnewline
        Adipisicing elit, sed do eiusmod tempor & \(0.40\) & Ut labore et dolore magna aliqua & \(7.77\) \tabularnewline
        Ut enim ad minim veniam, quis nostrud exercitation & \(0.93\) & Ullamco laboris nisi ut aliquip ex ea commodo consequat & \(62.6\) \tabularnewline
        \end{tabulary}
      }

      \begin{tablenotes}
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}

решение1

Вы можете заменить \makecellего командой \Centerstackиз stackengine, которая не конфликтует с другими пакетами:

\usepackage[latin]{babel} 
\usepackage[para]{threeparttable}
\usepackage{tabulary}
\usepackage[usestackEOL]{stackengine}

\begin{document}

  \begin{table}
    \begin{threeparttable}
      \caption{Lorem ipsum dolor sit amet, consectetur}

      {
        \begin{tabulary}{\linewidth}{L r L r}
        \textbf{Aaa} & \textbf{Bbb} & \textbf{Ccc} \tabularnewline
         & & \Centerstack{Ccc1} & \Centerstack{Ccc2\\ Ccc2} \tabularnewline
        Adipisicing elit, sed do eiusmod tempor & \(0.40\) & Ut labore et dolore magna aliqua & \(7.77\) \tabularnewline
        Ut enim ad minim veniam, quis nostrud exercitation & \(0.93\) & Ullamco laboris nisi ut aliquip ex ea commodo consequat & \(62.6\) \tabularnewline
        \end{tabulary}
      }

      \begin{tablenotes}\footnotesize
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}

\end{document} 

введите описание изображения здесь

Связанный контент