I am new to Latex and I am trying to generate a table for a document. I would like to have a horizontal line after the head and horizontal dashed lines between each entry. This is visible on the horrible image.

I have tried to find how to do it online but my attempt has failed, and this is why I am asking you help.

\begin{tabular}{|p{5cm}|c | c | c | c | c |}\hline%
\bfseries Variables & \bfseries Obs. & \bfseries Mean & \bfseries Std.~Dev. & \bfseries Min & \bfseries Max 
\csvreader[head to column names]{table1.csv}{}%
{\\\ \Variables & \Observations & \Mean & \StdDev & \Min & \Max}% 


Mortality rate, infant (per 1,000 live births),5506,59.33863,49.26514,1.5,223.6
Real consumption of households and government, at current PPPs,5991,204353.5,727248.7,85.18696,11500000
Rate of Urbanization,6798,0.01564,0.017847,-0.02725,0.177647
Dependency Ratio,1442,0.745555,0.184159,0.345188,1.136754
Exports of goods and services (BoP, current USD),3383,74200000000,2.08E+11,2199933,2.48E+12
Foreign direct investment, net inflows (perc. of GDP),4128,2.569829,7.098032,-58.9777,173.4499
Population in the largest city (perc. of urban population),5152,32.04351,14.89234,2.606237,100
KOF Globalization Index,4445,47.88659,19.24758,11.66,92.63
Area in sq. kms,6798,903878,1944170,316,9976139
Internal distance based on area,6798,261.8006,243.6016,6.686169,1187.996

Sorry for the drowing

  • Welcome to TeX SX! The code cannot be compiled. How do you define \Variables, \Observations and so on? – Bernard Nov 6 '16 at 13:11

The arydshln package provides a \hdashline command for adding dashed lines:

\begin{tabular}{|p{5cm}|c | c | c | c | c |}\hline%
\bfseries Variables & \bfseries Obs. & \bfseries Mean & \bfseries Std.~Dev. & \bfseries Min & \bfseries Max\\\hline
\csvreader[head to column names,
  late after line=\\\hdashline,
  late after last line=\\\hline
{\Variables & \Observations & \Mean & \StdDev & \Min & \Max}%

This gives:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.