tabularx環境で破線を作成する方法

tabularx環境で破線を作成する方法

私はこれを調べてきましたが、2 つの主な「解決策」に遭遇しました。

\usepackage{arydshln}

説明通りここ

そしてこれ:

\usepackage{dashrule}

記載の通りこの他の投稿

ただし、次のパッケージをロードしているため:

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

arydshlnどちらも使えないようですdashline

tabularxなぜこのようなことが起こるのか、何か分かりますか?どうすれば破線の水平線を私の中に表示できますか?同時に-環境内ではtable?

私が持っているのは次のものです:

\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}

\dashruleさて、がどこにある\hlineか(dashruleもちろんパッケージをロードした後)を使うと、未定義の制御シーケンスエラー。

\hdashline(パッケージの)を使用すると、arydshlnドキュメント内の他のテーブルを指す 101 エラーが発生するので、ロードした他のパッケージとの非互換性に関係していると思われます。

答え1

ここに画像の説明を入力してください

私の場合はエラーなく動作しましたが、うまく動作しない場合は、問題を示す例を作成する必要があります。

\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}

更新された例で、を にlongtabu変更すると動作します。パッケージには優れたアイデアがいくつかありますが、残念ながら、標準のLaTeX配列パッケージ構文を誤って定義しています(これはパッケージの意図的な、文書化された機能であり、バグではありません)。また、他の非互換性もあります。そのため、多くの場合、「タブーな方法」をとらなければならず、そのパッケージの機能を使用するか、パッケージの組み合わせを使用する必要があります。longtabulongtabletabu>{..}同時に使用しても衝突せず連携するように設計されています。

関連情報