表格超出 xltabular 的边缘

表格超出 xltabular 的边缘

对于超出边距的描述性表格有什么建议吗? 这是我的代码和输出:

\documentclass[12pt]{article}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{xltabular}
 \usepackage{float}

 \begin{document}

 \begin{xltabular}{\linewidth}{ l | X }
\caption{Description of Variables used in this Study} 
 \label{table: vardescription}\\
\hline \hline
\textbf{\normalsize } & \textbf{\normalsize List of countries}  \\
\hline 
 \endhead

   \textbf{Emerging Markets:} & Algeria,Angola,Argentina,Bahrain,Bangladesh,Bolivia,Hong Kong,Brazil,Israel,Bulgaria,NewZealand,Singapore,Sri Lanka,Chile,China,Colombia,CostaRica,Uruguay,Dominican Republic,Ecuador,ElSalvador,Equatorial,Guinea,Ethiopia,Eritrea,Fiji,Djibouti,
Gabon,Gambia,Ghana,Kiribati,Grenada,Guatemala,Guinea,Guyana,Haiti,Honduras,
Hungary,India,Indonesia,Iran,Iraq,Jamaica,Kazakhstan,Jordan,Kenya,Kuwait, Kyrgyzstan,Laos,Lebanon,Lesotho,Latvia,Liberia,Libya,Malawi,Malaysia,Maldives,Mali,Malta,Mauritania,Mauritius,Mexico,Mongolia,Moldova,Morocco,Mozambique,Oman,Namibia,Nepal,Aruba,Vanuatu,Nicaragua,Niger,Nigeria,Micronesia (Federated States of),Marshall Islands,Pakistan,Pama,Papua,New Guinea,Paraguay,Peru,Philippines,Poland,Guinea-Bissau,Qatar,Romania,Russia,Rwanda,Nevis St. Lucia St. Vincent,Gredines San Marino,Saudi Arabia,Senegal, Seychelles,Sierra Leone,Slovakia,Slovenia,Somalia,South Africa,Zimbabwe,Sudan,Surime,Eswatini, Syria,Vietnam,Thailand,Togo,Tonga,Trinidad \& Tobago,United Arab Emirates,Tunisia,Turkey,Turkmenistan, Uganda, Ukraine,North Macedonia,Egypt,Tanzania,BurkiFaso,Uruguay,Uzbekistan,Venezuela,Samoa,Yemen,Zambia \\ \hline 

\textbf{Developed countries:} & Australia, Austria, Belgium,Canada,Denmark,Finland,France,
Germany,Ireland,Italy,Brunei,Japan,Netherlands,New Zealand,
Norway Poland,Portugal,Spain,Sweden,Switzerland,United Kingdom,
Croatia,Cyprus,Czechia,United States,Estonia,Georgia,Greece,
Iceland,Austria,South Korea,Lithuania,Madagascar,Netherlands, Antilles
 \\ \hline
 \end{xltabular}
\end{document}

在此处输入图片描述

答案1

我将定义更窄的第一列(其中的文本将被分成两行)并且改用xltabularlongtnlr中定义的表格tabularray

顺便说一句,从您的 MWE 来看,没有证据表明确实需要长表。为此,可以使用tabularxtblr表格。

显示两种情况:

  • 第二张表格中的文字进行了调整:

在此处输入图片描述

对于这种情况,表格序言如下:

  • 第二列中的文本右侧不规则。

在此处输入图片描述

在这种情况下,完整的 MWE 是:

\documentclass[12pt]{article}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\hyphenation{Ki-ri-ba-ti  ka-zakh-stan  Mal-di-ves  Ukra-ine
            }

\begin{document}

    \begin{longtblr}[
caption = {Description of variables used in this study},
  label = {table: vardescription}
                    ]{hline{1,Z} = 0.8pt, hline{2-Y} = 0.5pt,
                      colspec = {@{} X[0.15, l, font=\bfseries] 
                                     X[0.85, cmd=\RaggedRight] @{}},
                      row{1} = {font=\bfseries},
                      rowhead =1
                      }
%
    & List of countries             \\
%
Emerging Markets
    & Algeria, Angola, Argentina, Aruba, Bahrain, Bangladesh, Bolivia, Hong Kong, Brazil, Israel, Bulgaria, Burkina Faso, Singapore, Sri Lanka, Chile, China, Colombia, Costa Rica, Uruguay, Dominican Republic, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eswatini, Ethiopia, Eritrea, Fiji, Djibouti, Gabon, Gambia, Ghana, Grenada, Guatemala, Guinea, Guyana, Haiti, Honduras, Hungary, India, Indonesia, Iran, Iraq, Jamaica, Kazakhstan, Jordan, Kenya, Kiribati, Kuwait, Kyrgyzstan, Laos, Lebanon, Lesotho, Latvia, Liberia, Libya, Malawi, Malaysia, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico, Micronesia (Federated States of), Mongolia, Moldova, Morocco, Mozambique, Marshall Islands, Namibia, Nepal, Nevis, New Zealand, Nicaragua, Niger, Nigeria, North Macedonia, Oman Pakistan, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Poland, Guinea-Bissau, Qatar, Romania, Russia, Rwanda, St. Lucia, St. Vincent \& Grenadines, San Marino, Saudi Arabia, Senegal, Seychelles, Sierra Leone, Slovakia, Slovenia, Somalia, South Africa, Samoa, Sudan, Suriname, Syria, Vietnam, Thailand, Togo, Tonga, Trinidad \& Tobago, United Arab Emirates, Tunisia, Turkey, Turkmenistan, Uganda, Ukraine, Tanzania, Uruguay, Uzbekistan, Vanuatu, Venezuela, Yemen, Zambia, Zimbabwe \\
%
Developed countries
    & Australia, Austria, Belgium, Canada, Denmark, Finland, France, Germany, Ireland, Italy, Brunei, Japan, Netherlands, New Zealand, Norway, Poland, Portugal, Spain, Sweden, Switzerland, United Kingdom, Croatia, Cyprus, Czechia, United States, Estonia, Georgia, Greece, Iceland, Austria, South Korea, Lithuania, Madagascar, Netherlands Antilles \\
\end{longtblr}
\end{document}

答案2

除了确保逗号后有空格、修正几个拼写错误(例如“BurkiFaso” “Pama” 和 Surime” [!] 中缺少“na ”子字符串,以及添加缺失的逗号和删除虚假的逗号(例如“Equatorial,Guinea”)外,还请考虑不是对第二列的材料进行充分的调整。

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{booktabs,xltabular,ragged2e,booktabs}

\begin{document}

\begin{xltabular}{\linewidth}{@{} l >{\RaggedRight}X @{}}

\caption{Description of variables used in this study} \label{table: vardescription}\\
\toprule
& List of countries \\
\midrule
\endhead

\bottomrule
\endlastfoot

Emerging Markets
& Algeria, Angola, Argentina, Bahrain, Bangladesh, Bolivia, Hong Kong, Brazil, Israel, Bulgaria, New Zealand, Singapore, Sri Lanka, Chile, China, Colombia, Costa Rica, Uruguay, Dominican Republic, Ecuador, El Salvador, Equatorial Guinea, Ethiopia, Eritrea, Fiji, Djibouti, Gabon, Gambia, Ghana, Kiribati, Grenada, Guatemala, Guinea, Guyana, Haiti, Honduras, Hungary, India, Indonesia, Iran, Iraq, Jamaica, Kazakhstan, Jordan, Kenya, Kuwait, Kyrgyzstan, Laos, Lebanon, Lesotho, Latvia, Liberia, Libya, Malawi, Malaysia, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico, Mongolia, Moldova, Morocco, Mozambique, Oman, Namibia, Nepal, Aruba, Vanuatu, Nicaragua, Niger, Nigeria, Micronesia (Federated States of), Marshall Islands, Pakistan, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Poland, Guinea-Bissau, Qatar, Romania, Russia, Rwanda, Nevis, St.\ Lucia, St.\ Vincent \& Grenadines, San Marino, Saudi Arabia, Senegal, Seychelles, Sierra Leone, Slovakia, Slovenia, Somalia, South Africa, Zimbabwe, Sudan, Suriname, Eswatini, Syria, Vietnam, Thailand, Togo, Tonga, Trinidad \& Tobago, United Arab Emirates, Tunisia, Turkey, Turkmenistan, Uganda, Ukraine, North Macedonia, Egypt, Tanzania, Burkina Faso, Uruguay, Uzbekistan, Venezuela, Samoa, Yemen, Zambia \\
\midrule
Developed countries
& Australia, Austria, Belgium, Canada, Denmark, Finland, France, Germany, Ireland, Italy, Brunei, Japan, Netherlands, New Zealand, Norway, Poland, Portugal, Spain, Sweden, Switzerland, United Kingdom, Croatia, Cyprus, Czechia, United States, Estonia, Georgia, Greece, Iceland, Austria, South Korea, Lithuania, Madagascar, Netherlands Antilles \\

\end{xltabular}
\end{document} 

相关内容