Como criar uma linha tracejada em ambiente tabularx

Como criar uma linha tracejada em ambiente tabularx

Estive investigando isso e encontrei duas "soluções" principais:

\usepackage{arydshln}

Conforme descritoaqui.

E este:

\usepackage{dashrule}

Conforme descrito emesta outra postagem.

No entanto, como estou carregando esses pacotes:

\usepackage{array}
\usepaclage{tabularx}
\usepackage{longtable}
\usepackage{tabu}

Parece que não posso usar nem arydshlnnem dashline.

Alguma ideia de por que isso está acontecendo? Como posso obter uma linha horizontal tracejada dentro do meu tabularxque éao mesmo tempo-dentro de um tableambiente?

Isto é o que eu tenho:

\documentclass{article}

\usepackage{multirow}
\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}


\begin{document}
Hello.

\begin{longtabu}{l p{0.8\linewidth}}
WHO                 &   \hspace{5mm} World Health Organization\\[1mm]
GDP                 & \hspace{5mm} Gross Domestic Product\\[1mm]
PPP                 & \hspace{5mm} Purchasing Power Parities\\[1mm]

\end{longtabu}

\begin{table}\tiny
    \caption{Muscles of the thigh}
    \newcolumntype{Y}{>{\raggedright\arraybackslash}X}
    \begin{tabularx}{\textwidth}{YYYYY}
        Muscle & Origin & Insertion& Nerve & Action \\
        \firsthline\\
            \textbf{Anterior Compartment}   & & &   &   \\[3mm]

            Quadriceps femoris                                                                                          &
            Rectus Femoris: anterior inferior iliac spine. Vastus Lateralis: greater trochanter and linea aspera of femur. Vastus Intermedius: body of femur.  Vastus Medialis: linea aspera of femur                &
            Patella and onto tibial tuberosity through patellar ligament        &
            Femoral                                                                                                                 &
            Extends knee; rectus femoris also flexes hip\\\\

            Sartorius                                                                                                               &
            Anterior superiro iliac spine                                                                       &
            Medial side of tibial tuberosity                                                                &
            Femoral                                                                                                                 &
            Flexes hip and knee; rotates thigh laterally and leg medially\\\\

            \hline\\% I want this line to be dashed
            \textbf{Medial Compartment} & & &   &   \\[3mm]

            Adductor brevis                                                                                                 &
            Pubis                                                                                                                       &
            Pectineal line and linea aspera of femur                                                &
            Obturator                                                                                                               &
            Adducts, laterally rotates thigh; flexes hip\\\\

            Adductor longus                                                                                                 &
            Pubis                                                                                                                       &
            Linea aspera of femur                                                                                       &
            Obturator                                                                                                               &
            Adducts, laterally rotates thigh; flexes hip\\\\

            \lasthline\\
    \end{tabularx}
    \label{tab:ThighMuscles2}
\end{table} 


\end{document}

Agora, se eu usar \dashrulewhere the \hlineis (depois de carregar o dashrulepacote, é claro), recebo umSequência de controle indefinidaerro.

Se eu usar o \hdashline(do arydshlnpacote), recebo 101 erros que me apontam para outras tabelas no meu documento, então acho que tem algo a ver com incompatibilidade com os outros pacotes que carreguei.

Responder1

insira a descrição da imagem aqui

Funcionou para mim sem erros, se não funcionar para você você precisa fazer um exemplo que mostre o problema.

\documentclass{article}

\usepackage{multirow}
\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{arydshln}

\begin{document}
Hello.

\begin{table}\tiny
    \caption{Muscles of the thigh}
    \newcolumntype{Y}{>{\raggedright\arraybackslash}X}
    \begin{tabularx}{\textwidth}{YYYYY}
        Muscle & Origin & Insertion& Nerve & Action \\
        \firsthline\\
            \textbf{Anterior Compartment}   & & &   &   \\[3mm]

            Quadriceps femoris                                                                                          &
            Rectus Femoris: anterior inferior iliac spine. Vastus Lateralis: greater trochanter and linea aspera of femur. Vastus Intermedius: body of femur.  Vastus Medialis: linea aspera of femur                &
            Patella and onto tibial tuberosity through patellar ligament        &
            Femoral                                                                                                                 &
            Extends knee; rectus femoris also flexes hip\\\\

            Sartorius                                                                                                               &
            Anterior superiro iliac spine                                                                       &
            Medial side of tibial tuberosity                                                                &
            Femoral                                                                                                                 &
            Flexes hip and knee; rotates thigh laterally and leg medially\\\\

            \hdashline\\% I want this line to be dashed
            \textbf{Medial Compartment} & & &   &   \\[3mm]

            Adductor brevis                                                                                                 &
            Pubis                                                                                                                       &
            Pectineal line and linea aspera of femur                                                &
            Obturator                                                                                                               &
            Adducts, laterally rotates thigh; flexes hip\\\\

            Adductor longus                                                                                                 &
            Pubis                                                                                                                       &
            Linea aspera of femur                                                                                       &
            Obturator                                                                                                               &
            Adducts, laterally rotates thigh; flexes hip\\\\

            \lasthline\\
    \end{tabularx}
    \label{tab:ThighMuscles2}
\end{table} 


\end{document}

Com o exemplo atualizado usando longtabuFunciona se você mudar longtabupara longtableO tabupacote tem algumas boas idéias, mas infelizmente define incorretamente a >{..}sintaxe padrão do pacote de matriz de látex (Este é um recurso intencional e documentado do pacote, não um bug como tal) e tem outras incompatibilidades , muitas vezes você precisa seguir o "caminho tabu" e apenas usar os recursos desse pacote ou usar uma combinação de pacotes quesãoprojetado para cooperar e não entrar em conflito quando usado ao mesmo tempo.

informação relacionada