/test/target/ok/table.tex

http://txt2tags.googlecode.com/ · LaTeX · 185 lines · 140 code · 43 blank · 2 comment · 0 complexity · 8937bdbf3b5aa8352536040121e61df3 MD5 · raw file

  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \usepackage{paralist} % needed for compact lists
  4. \usepackage[normalem]{ulem} % needed by strike
  5. \usepackage[urlcolor=blue,colorlinks=true]{hyperref}
  6. \begin{document}
  7. \maketitle
  8. \clearpage
  9. \section*{Simple table}
  10. \begin{center}\begin{tabular}{lll}
  11. Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  12. Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  13. Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  14. \end{tabular}\end{center}
  15. \section*{Simple table + border}
  16. \begin{center}\begin{tabular}{|l|l|l|}
  17. \hline Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  18. \hline Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  19. \hline Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  20. \hline \end{tabular}\end{center}
  21. \section*{Simple table + heading}
  22. \begin{center}\begin{tabular}{lll}
  23. \textbf{Head 1-1} & \textbf{Head 1-2} & \textbf{Head 1-3} \\
  24. Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  25. Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  26. Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  27. \end{tabular}\end{center}
  28. \section*{Simple table + heading + border}
  29. \begin{center}\begin{tabular}{|l|l|l|}
  30. \hline \textbf{Head 1-1} & \textbf{Head 1-2} & \textbf{Head 1-3} \\
  31. \hline Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  32. \hline Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  33. \hline Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  34. \hline \end{tabular}\end{center}
  35. \section*{Simple table + heading + border + footer}
  36. \begin{center}\begin{tabular}{|l|l|l|}
  37. \hline \textbf{Head 1-1} & \textbf{Head 1-2} & \textbf{Head 1-3} \\
  38. \hline Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  39. \hline Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  40. \hline Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  41. \hline \textbf{Foot 1-1} & \textbf{Foot 1-2} & \textbf{Foot 1-3} \\
  42. \hline \end{tabular}\end{center}
  43. \section*{Simple table + heading + border + centralized}
  44. \begin{center}\begin{tabular}{|l|l|l|}
  45. \hline \textbf{Head 1-1} & \textbf{Head 1-2} & \textbf{Head 1-3} \\
  46. \hline Cell 1-1 & Cell 1-2 & Cell 1-3 \\
  47. \hline Cell 2-1 & Cell 2-2 & Cell 2-3 \\
  48. \hline Cell 3-1 & Cell 3-2 & Cell 3-3 \\
  49. \hline \end{tabular}\end{center}
  50. \section*{Cell alignment}
  51. \begin{center}\begin{tabular}{|l|l|}
  52. \hline ======= & ======= \\
  53. \hline $<$ & \multicolumn{1}{|r|}{$>$} \\
  54. \hline \multicolumn{1}{|c|}{=} & \multicolumn{1}{|c|}{=} \\
  55. \hline \multicolumn{1}{|r|}{$>$} & $<$ \\
  56. \hline \end{tabular}\end{center}
  57. \section*{Heading alignment}
  58. \begin{center}\begin{tabular}{|l|l|}
  59. \hline \textbf{=======} & \textbf{=======} \\
  60. \hline \textbf{$<$} & \multicolumn{1}{|r|}{\textbf{$>$}} \\
  61. \hline \multicolumn{1}{|c|}{\textbf{=}} & \multicolumn{1}{|c|}{\textbf{=}} \\
  62. \hline \multicolumn{1}{|r|}{\textbf{$>$}} & \textbf{$<$} \\
  63. \hline \end{tabular}\end{center}
  64. \section*{Column span for cells}
  65. \begin{center}\begin{tabular}{|l|l|l|l|}
  66. \hline 1 & 2 & 3 & 4 \\
  67. \hline 1 & 2 & \multicolumn{2}{|l|}{3 + 4} \\
  68. \hline \multicolumn{3}{|l|}{1 + 2 + 3} & 4 \\
  69. \hline 1 & \multicolumn{2}{|l|}{2 + 3} & 4 \\
  70. \hline \multicolumn{4}{|l|}{1 + 2 + 3 + 4} \\
  71. \hline \end{tabular}\end{center}
  72. \section*{Column span for headings}
  73. \begin{center}\begin{tabular}{|l|l|l|l|}
  74. \hline \textbf{1} & \textbf{2} & \textbf{3} & \textbf{4} \\
  75. \hline \textbf{1} & \textbf{2} & \multicolumn{2}{|l|}{\textbf{3 + 4}} \\
  76. \hline \multicolumn{3}{|l|}{\textbf{1 + 2 + 3}} & \textbf{4} \\
  77. \hline \textbf{1} & \multicolumn{2}{|l|}{\textbf{2 + 3}} & \textbf{4} \\
  78. \hline \multicolumn{4}{|l|}{\textbf{1 + 2 + 3 + 4}} \\
  79. \hline \end{tabular}\end{center}
  80. \section*{Cell alignment + column span}
  81. \begin{center}\begin{tabular}{|l|l|l|}
  82. \hline ======= & ======= & ======= \\
  83. \hline \multicolumn{2}{|l|}{$<$} & \multicolumn{1}{|c|}{=} \\
  84. \hline \multicolumn{3}{|c|}{=} \\
  85. \hline \multicolumn{1}{|c|}{=} & \multicolumn{2}{|r|}{$>$} \\
  86. \hline \end{tabular}\end{center}
  87. \section*{Heading alignment + column span}
  88. \begin{center}\begin{tabular}{|l|l|l|}
  89. \hline \textbf{=======} & \textbf{=======} & \textbf{=======} \\
  90. \hline \multicolumn{2}{|l|}{\textbf{$<$}} & \multicolumn{1}{|c|}{\textbf{=}} \\
  91. \hline \multicolumn{3}{|c|}{\textbf{=}} \\
  92. \hline \multicolumn{1}{|c|}{\textbf{=}} & \multicolumn{2}{|r|}{\textbf{$>$}} \\
  93. \hline \end{tabular}\end{center}
  94. \section*{Some empty cells}
  95. \begin{center}\begin{tabular}{|l|l|l|l|l|}
  96. \hline A & B & C & D & \\
  97. \hline F & G & H & & J \\
  98. \hline K & L & & N & O \\
  99. \hline P & & R & S & T \\
  100. \hline & V & W & X & Y \\
  101. \hline \end{tabular}\end{center}
  102. \section*{Lines with different number of cells, increase}
  103. \begin{center}\begin{tabular}{|l|}
  104. \hline 1 \\
  105. \hline 1 & 2 \\
  106. \hline 1 & 2 & 3 \\
  107. \hline 1 & 2 & 3 & 4 \\
  108. \hline 1 & 2 & 3 & 4 & 5 \\
  109. \hline \end{tabular}\end{center}
  110. \section*{Lines with different number of cells, decrease}
  111. \begin{center}\begin{tabular}{|l|l|l|l|l|}
  112. \hline 1 & 2 & 3 & 4 & 5 \\
  113. \hline 1 & 2 & 3 & 4 \\
  114. \hline 1 & 2 & 3 \\
  115. \hline 1 & 2 \\
  116. \hline 1 \\
  117. \hline \end{tabular}\end{center}
  118. \section*{One cell table}
  119. \begin{center}\begin{tabular}{l}
  120. Cell 1 \\
  121. \end{tabular}\end{center}
  122. \section*{One cell table + border}
  123. \begin{center}\begin{tabular}{|l|}
  124. \hline Cell 1 \\
  125. \hline \end{tabular}\end{center}
  126. \section*{One cell table + heading}
  127. \begin{center}\begin{tabular}{l}
  128. \textbf{Head 1} \\
  129. \end{tabular}\end{center}
  130. \section*{One cell table + heading + border}
  131. \begin{center}\begin{tabular}{|l|}
  132. \hline \textbf{Head 1} \\
  133. \hline \end{tabular}\end{center}
  134. \section*{Empty lines}
  135. \begin{center}\begin{tabular}{|l|}
  136. \hline \\
  137. \hline \\
  138. \hline \\
  139. \hline \end{tabular}\end{center}
  140. % LaTeX2e code generated by txt2tags (http://txt2tags.org)
  141. % cmdline: txt2tags -q --no-rc -i table.t2t -t tex
  142. \end{document}