我刚开始使用 sharelatex,我阅读了许多手册和关于长表格的先前问题,但我的长表格不适合我的文档。它太宽了,超出了边距。它也不会旋转。如果您能帮助我,我将非常高兴,因为我不知道在哪里可以找到解决方案。这是文本:
\begin{sidewaytable}
\begin{longtable}{|c|c|c|c|}
\hline
Variable &Type/ denomination &Source&Employed in:
\hline
Compulsory voting
&Dummy=1 if voting compulsory in country i at time t &Self-created based on IDEA information
&(2a), (3a)
\hline
Voting age &Minimum age to vote in country i at time t &IDEA&
\hline
Urban population
&\% population living in cities &WB &(2a), (3a)
\hline
Gini coefficient&Gini coefficient estimate &WB&(2a)
\hline
High\_Ten &\% of country i’s GNI held by richest 10\% of population &WB
\hline
Patents &Patent application from residents of country i at time t &WB
\hline
Oda &Net ODA received per capita &WB &(2a)
\hline
Literacy &Literacy rate of population above 15 &WB
\hline
Life &Life expectancy at birth, in years &WB&
\hline
Net exports&Exports in current US \$ - Imports in current US \$& Self-created based on WB data &(2a), (3a)
\hline
Inflation &CPI index, growth rate in country i from t-1 to t, relative to time t &WB&
\hline
Agriculture value added&As a \% of GDP &WB
\hline
C02 emissions&In tons per capita&WB
\hline
Domestic credit &To the private sector, as a \% of GDP &WB\\
\label{tab2}
\end{longtable}
\end{sidewaytable}
答案1
这里不需要长表,并且请不要使用垂直线:
\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{rotating,booktabs,array}
\usepackage{tabulary}
\begin{document}
\begin{sidewaystable}
\setlength\belowcaptionskip{1ex}
\caption{The caption of this table.}
\renewcommand\arraystretch{1.6}
\begin{tabulary}{\linewidth}{LLLL}
\toprule
Variable & Type/ denomination & Source & Employed in: \\\midrule
Compulsory voting
& Dummy=1 if voting compulsory in country i at time t & Self-created based on IDEA information
& (2a), (3a) \\
Voting age & Minimum age to vote in country i at time t & IDEA & \\
Urban population
& \% population living in cities & WB & (2a), (3a) \\
Gini coefficient & Gini coefficient estimate & WB & (2a) \\
High\_Ten & \% of country i’s GNI held by richest 10\% of population & WB \\
Patents & Patent application from residents of country i at time t & WB \\
Oda & Net ODA received per capita & WB & (2a) \\
Literacy & Literacy rate of population above 15 & WB \\
Life & Life expectancy at birth, in years & WB & \\
Net exports & Exports in current US \$ - Imports in current US \$ & Self-created based on WB data & (2a), (3a) \\
Inflation & CPI index, growth rate in country i from t-1 to t, relative to time t & WB & \\
Agriculture value added & As a \% of GDP & WB \\
C02 emissions & In tons per capita & WB \\
Domestic credit & To the private sector, as a \% of GDP & WB\\ \\\bottomrule
\end{tabulary}
\end{sidewaystable}
\end{document}
答案2
\documentclass[12pt,a4paper]{article}
\usepackage{lscape,ltablex}
\begin{document}
\begin{landscape}
\begin{tabularx}{\linewidth}{|p{8em}|X|p{9em}|p{4em}|}
\hline
Variable & Type/denomination & Source & Employed in: \\ \hline
Compulsory voting & Dummy=1 if voting compulsory in country i at time t & Self-created based on IDEA information & (2a), (3a) \\ \hline
Voting age & Minimum age to vote in country i at time t & IDEA & \\ \hline
Urban population & \% population living in cities & WB & (2a), (3a) \\ \hline
Gini coefficient & Gini coefficient estimate & WB & (2a) \\ \hline
High\_Ten & \% of country i’s GNI held by richest 10\% of population & WB & \\ \hline
Patents & Patent application from residents of country i at time t & WB & \\ \hline
Oda & Net ODA received per capita & WB & (2a) \\ \hline
Literacy & Literacy rate of population above 15 & WB & \\ \hline
Life & Life expectancy at birth, in years & WB & \\ \hline
Net exports & Exports in current US \$ - Imports in current US \$ & Self-created based on WB data & (2a), (3a) \\ \hline
Inflation & CPI index, growth rate in country i from t-1 to t, relative to time t & WB & \\ \hline
Agriculture value added & As a \% of GDP & WB & \\ \hline
C02 emissions & In tons per capita & WB & \\ \hline
Domestic credit & To the private sector, as a \% of GDP & WB & \\ \hline
\end{tabularx}
\end{landscape}
\end{document}