Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. documentclass{article}
  2. usepackage[T1]{fontenc}
  3. usepackage{amsmath}
  4. usepackage[skip=10pt]{parskip}
  5. usepackage[table]{xcolor}
  6. usepackage{rotating}
  7. usepackage{array}
  8. usepackage{booktabs}
  9. usepackage{makecell}
  10. usepackage[column=Q]{cellspace} % changed to Q for simultaneous use of siunitx
  11.  
  12. newcommand{tableComment}[2]{
  13. begin{tabular}{m{4.5cm}}
  14. #1\[5pt]#2
  15. end{tabular}}
  16.  
  17. renewcommand{theadfont}{itshape}
  18. renewcommand{theadgape}{}
  19. renewcommand{theadalign}{cc}
  20. setcellgapes{1pt}
  21. renewcommand{cellrotangle}{90}
  22.  
  23. newcommand{TopRule}{Xhline{1pt}}
  24. newcommand{MidRule}{Xhline{.5pt}}
  25. newcommand{BottomRule}{Xhline{1pt}}
  26.  
  27.  
  28. begin{document}
  29.  
  30. tableComment{1: Standard Lines, Head with texttt{makecell}, no additional spacing}
  31. {
  32. rowcolors{1}{gray!20}{white}
  33. begin{tabular}{ll}hline
  34. rowcolor{gray!40}
  35. My Head & makecell{My second\ Head} \ hline
  36. some content & $dfrac{1}{2}$ \
  37. foo & bar \ hline
  38. end{tabular}
  39. }
  40. tableComment{2: Standard Lines, Head with texttt{makecell}, spacing with texttt{cellspace}}
  41. {
  42. rowcolors{1}{gray!20}{white}
  43. begin{tabular}{QlQl}hline
  44. rowcolor{gray!40}
  45. My Head & makecell{My second\ Head} \ hline
  46. some content & $dfrac{1}{2}$ \
  47. foo & bar \ hline
  48. end{tabular}
  49. }
  50. tableComment{3: Lines with texttt{Xhline}, Head with texttt{makecell}, spacing with texttt{cellspace}}
  51. {
  52. rowcolors{1}{gray!20}{white}
  53. begin{tabular}{QlQl}TopRule
  54. rowcolor{gray!40}
  55. My Head & makecell{My second\ Head} \ MidRule
  56. some content & $dfrac{1}{2}$ \
  57. foo & bar \ BottomRule
  58. end{tabular}
  59. }\
  60.  
  61. tableComment{4: Lines with texttt{Xhline}, Head with texttt{thead}, spacing with texttt{makegapedcells}}
  62. {
  63. rowcolors{1}{gray!20}{white}
  64. makegapedcells
  65. begin{tabular}{ll}TopRule
  66. rowcolor{gray!40}
  67. thead{My Head} & thead{My second\ Head} \ MidRule
  68. some content & $dfrac{1}{2}$ \
  69. foo & bar \ BottomRule
  70. end{tabular}
  71. }
  72. tableComment{5: Lines with texttt{booktabs}, Head with texttt{makecell}, spacing with texttt{booktabs}}
  73. {
  74. rowcolors{1}{gray!20}{white}
  75. begin{tabular}{ll}toprule
  76. rowcolor{gray!40}
  77. My Head & makecell{My second\ Head} \ midrule
  78. some content & $dfrac{1}{2}$ \
  79. foo & bar \ bottomrule
  80. end{tabular}
  81. }
  82. tableComment{6: Lines with texttt{Xhline}, Head with texttt{thead}, spacing with texttt{cellspace}}
  83. {
  84. rowcolors{1}{gray!20}{white}
  85. begin{tabular}{QlQl}TopRule
  86. rowcolor{gray!40}
  87. thead{My Head} & thead{My second\ Head} \ MidRule
  88. some content & $dfrac{1}{2}$ \
  89. foo & bar \ BottomRule
  90. end{tabular}
  91. }
  92.  
  93. settowidthrotheadsize{theadfont second}
  94. tableComment{7: Lines with texttt{Xhline}, Head with texttt{rothead}, spacing with texttt{callspace} }
  95. {
  96. rowcolors{1}{gray!20}{white}
  97. begin{tabular}{QlQl}TopRule
  98. rowcolor{gray!40}
  99. rothead{My\Head} & rothead{My\second\ Head} \ MidRule
  100. some content & $dfrac{1}{2}$ \
  101. foo & bar \ BottomRule
  102. end{tabular}
  103. }
  104. tableComment{8: Lines with texttt{booktabs}, Head with texttt{rothead}, spacing with texttt{booktabs}}
  105. {
  106. rowcolors{1}{gray!20}{white}
  107. begin{tabular}{ll}toprule
  108. rowcolor{gray!40}
  109. rothead{My\Head} & rothead{My\second\ Head} \midrule
  110. some content & $dfrac{1}{2}$ \
  111. foo & bar \ bottomrule
  112. end{tabular}
  113. }
  114. tableComment{9: Lines with texttt{Xhline}, Head with texttt{rothead}, spacing with texttt{makegapedcells}}
  115. {
  116. rowcolors{1}{gray!20}{white}
  117. makegapedcells
  118. begin{tabular}{ll}TopRule
  119. rowcolor{gray!40}
  120. rothead{My\Head} & rothead{My\second\ Head} \ MidRule
  121. some content & $dfrac{1}{2}$ \
  122. foo & bar \ BottomRule
  123. end{tabular}
  124. }
  125. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement