tex.vader 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # http://en.wikibooks.org/wiki/LaTeX/Tables
  2. Include: include/setup.vader
  3. Given tex (table with escaped &):
  4. \begin{tabular}{ l c r }
  5. 1&2&3\\
  6. 44&55&66\\
  7. 777&8\&8&999\\
  8. \end{tabular}
  9. # FIXME vip doesn't work if folded
  10. Do (Align around all &s and \\s):
  11. VG\<Enter>*&
  12. Expect tex:
  13. \begin{tabular}{ l c r }
  14. 1 & 2 & 3 \\
  15. 44 & 55 & 66 \\
  16. 777 & 8\&8 & 999 \\
  17. \end{tabular}
  18. Do (right-align with explicit ignore_unmatched):
  19. VG\<Enter>\<Enter>\<C-U>\<C-U>*&
  20. Expect tex:
  21. \begin{tabular}{ l c r }
  22. 1 & 2 & 3 \\
  23. 44 & 55 & 66 \\
  24. 777 & 8\&8 & 999 \\
  25. \end{tabular}
  26. Do (center-align with explicit ignore_unmatched):
  27. VG\<Enter>\<Enter>\<Enter>\<C-U>\<C-U>*&
  28. Expect tex:
  29. \begin{tabular}{ l c r }
  30. 1 & 2 & 3 \\
  31. 44 & 55 & 66 \\
  32. 777 & 8\&8 & 999 \\
  33. \end{tabular}
  34. Given tex (simple table with \hline):
  35. \begin{tabular}{ l c r }
  36. 1&2&3\\ \hline
  37. 44&55&66\\ \hline
  38. 777&8\&&999\\ \hline
  39. \end{tabular}
  40. Do:
  41. VG\<Enter>*&
  42. Expect tex:
  43. \begin{tabular}{ l c r }
  44. 1 & 2 & 3 \\ \hline
  45. 44 & 55 & 66 \\ \hline
  46. 777 & 8\& & 999 \\ \hline
  47. \end{tabular}
  48. Given tex (table with lines w/o &s):
  49. \begin{tabular}{|r|l|}
  50. \hline
  51. 7C0 & hexadecimal \\
  52. 3700&octal \\ \cline{2-2}
  53. 1111100000 & binary \\
  54. \hline \hline
  55. 1984 & decimal \\
  56. \hline
  57. \end{tabular}
  58. Do (left-align*):
  59. VG\<Enter>*&
  60. Expect tex:
  61. \begin{tabular}{|r|l|}
  62. \hline
  63. 7C0 & hexadecimal \\
  64. 3700 & octal \\ \cline{2-2}
  65. 1111100000 & binary \\
  66. \hline \hline
  67. 1984 & decimal \\
  68. \hline
  69. \end{tabular}
  70. Do(left-align* and right-align around 2nd):
  71. VG\<Enter>*&
  72. gv\<Enter>\<Enter>2&
  73. Expect tex:
  74. \begin{tabular}{|r|l|}
  75. \hline
  76. 7C0 & hexadecimal \\
  77. 3700 & octal \\ \cline{2-2}
  78. 1111100000 & binary \\
  79. \hline \hline
  80. 1984 & decimal \\
  81. \hline
  82. \end{tabular}
  83. Given tex:
  84. \begin{tabular}{}
  85. 32&1.14\e1&&5.65\e2&&&&1.16\e1&&1.28\e1&\\
  86. 64&1.03\e1&0.1&4.98\e2&0.2&&&9.21\e2&0.3&1.02\e1&0.3\\
  87. 128&9.86\e2&0.1&4.69\e2&0.1&&&8.46\e2&0.1&9.45\e2&0.1\\
  88. 256&9.65\e2&0.0&4.59\e2&0.0&&&8.15\e2&0.1&9.11\e2&0.1\\
  89. % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
  90. 1024&9.49\e2&0.0&4.53\e2&0.0&&&7.94\e2&0.0&8.89\e2&0.0\\
  91. 2048&9.47\e2&0.0&4.52\e2&0.0&&&7.91\e2&0.0&8.85\e2&0.0\\
  92. 4096&9.46\e2&0.0&4.51\e2&0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
  93. 8192&9.45\e2&0.0&4.51\e2&0.0&&&&&&\\
  94. \end{tabular}
  95. Execute (Alignment around &s, foldmethod should not change):
  96. setlocal foldmethod=syntax
  97. %EasyAlign*&
  98. AssertEqual 'syntax', &l:foldmethod
  99. setlocal foldmethod=manual
  100. %EasyAlign*&
  101. AssertEqual 'manual', &l:foldmethod
  102. Expect tex:
  103. \begin{tabular}{}
  104. 32 & 1.14\e1 & & 5.65\e2 & & & & 1.16\e1 & & 1.28\e1 & \\
  105. 64 & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 & & & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
  106. 128 & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 & & & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
  107. 256 & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 & & & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
  108. % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
  109. 1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 & & & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
  110. 2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 & & & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
  111. 4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
  112. 8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 & & & & & & \\
  113. \end{tabular}
  114. Execute (g:easy_align_bypass_fold set, foldmethod should not change):
  115. let g:easy_align_bypass_fold = 1
  116. setlocal foldmethod=syntax
  117. %EasyAlign*&
  118. AssertEqual 'syntax', &l:foldmethod
  119. setlocal foldmethod=manual
  120. %EasyAlign*&
  121. AssertEqual 'manual', &l:foldmethod
  122. Expect tex:
  123. \begin{tabular}{}
  124. 32 & 1.14\e1 & & 5.65\e2 & & & & 1.16\e1 & & 1.28\e1 & \\
  125. 64 & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 & & & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
  126. 128 & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 & & & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
  127. 256 & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 & & & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
  128. % 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
  129. 1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 & & & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
  130. 2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 & & & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
  131. 4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
  132. 8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 & & & & & & \\
  133. \end{tabular}
  134. Include: include/teardown.vader