Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. documentclass{beamer}
  2. usepackage{booktabs}
  3.  
  4. begin{document}
  5. begin{frame}{Example}
  6. begin{tabular}{ll}
  7. toprule
  8. bla & bla \
  9. midrule
  10. A & A \
  11. B & B \
  12. only<1>{%
  13. midrule
  14. C & C \
  15. D & D \ }
  16. bottomrule
  17. end{tabular}
  18.  
  19. only<2>{Something else}
  20. end{frame}
  21.  
  22. end{document}
  23.  
  24. documentclass{beamer}
  25. usepackage{booktabs}
  26.  
  27. begin{document}
  28. begin{frame}{Example}
  29. begin{tabular}{ll}
  30. toprule
  31. bla & bla \
  32. midrule
  33. A & A \
  34. B & B %
  35. only<1>{%
  36. \midrule
  37. C & C %
  38. }%
  39. only<2>%
  40. {%
  41. \
  42. D & D %
  43. }%
  44. \ bottomrule
  45. end{tabular}
  46. end{frame}
  47.  
  48. end{document}
  49.  
  50. begin{frame}{Example}
  51. only<1>{begin{tabular}{ll}
  52. toprule
  53. bla & bla \
  54. midrule
  55. A & A \
  56. B & B \
  57. midrule
  58. C & C \
  59. D & D \
  60. bottomrule
  61. end{tabular}
  62. }
  63. only<2->{begin{tabular}{ll}
  64. toprule
  65. bla & bla \
  66. midrule
  67. A & A \
  68. B & B \
  69. bottomrule
  70. end{tabular}
  71. }
  72. only<2>{Something else}
  73. end{frame}
  74.  
  75. documentclass{beamer}
  76. usepackage{booktabs}
  77.  
  78.  
  79. % ------- xalt -------
  80.  
  81. makeatletter
  82.  
  83. providecommand@secondofthree[3]{#2}
  84.  
  85. defxalt<#1>{%
  86. if *#1%
  87. % matches any overlay
  88. expandafter @secondofthree
  89. else
  90. % continue overlay check
  91. expandafter @firstofone
  92. fi
  93. {@xalt@checkrange<#1->}%
  94. }
  95.  
  96. def@xalt@checkrange<#1-#2>{%
  97. ifx relax#2relax
  98. % is not a range
  99. expandafter @firstoftwo
  100. else
  101. % is a range
  102. expandafter @secondoftwo
  103. fi
  104. {@xalt@checknumber<#1>}%
  105. {@xalt@checklower<#1-#2>}%
  106. }
  107.  
  108. def@xalt@checknumber<#1>{%
  109. ifnum beamer@slideinframe=#1
  110. % overlay is matched
  111. expandafter @firstoftwo
  112. else
  113. % overlay is *not* matched
  114. expandafter @secondoftwo
  115. fi
  116. }
  117.  
  118. def@xalt@checklower<#1-#2>{%
  119. ifx relax#1relax
  120. % lower bound not given => match
  121. expandafter @firstofone
  122. else ifnum beamer@slideinframe<#1
  123. % overlay is *not* matched
  124. expandafterexpandafterexpandafter @thirdofthree
  125. else
  126. % lower bound is matched
  127. expandafterexpandafterexpandafter @firstofone
  128. fi fi
  129. {@xalt@checkupper<-#2>}%
  130. }
  131.  
  132. % #2 ends with an additional -
  133.  
  134. def@xalt@checkupper<-#1->{%
  135. ifx relax#1relax
  136. % upper bound not given => match
  137. expandafter @firstoftwo
  138. else ifnum beamer@slideinframe>#1
  139. % overlay is *not* matched
  140. expandafterexpandafterexpandafter @secondoftwo
  141. else
  142. % upper bound is matched
  143. expandafterexpandafterexpandafter @firstoftwo
  144. fi fi
  145. }
  146.  
  147. makeatother
  148.  
  149.  
  150. % ------- toprule -------
  151.  
  152. letoriginaltoprule=toprule
  153.  
  154. defoverlayawaretoprule<#1>{%
  155. xalt<#1>%
  156. {toprule}%
  157. {addlinespace[dimexpr abovetopsep + heavyrulewidth + belowrulesep relax]}%
  158. }
  159.  
  160. renewcommand{toprule}[1]{%
  161. ifx <#1%
  162. expandafter overlayawaretoprule
  163. else
  164. expandafter originaltoprule
  165. fi
  166. #1%
  167. }
  168.  
  169. % ------- midrule -------
  170.  
  171. letoriginalmidrule=midrule
  172.  
  173. defoverlayawaremidrule<#1>{%
  174. xalt<#1>%
  175. {midrule}%
  176. {addlinespace[dimexpr aboverulesep + lightrulewidth + belowrulesep relax]}%
  177. }
  178.  
  179. renewcommand{midrule}[1]{%
  180. ifx <#1%
  181. expandafter overlayawaremidrule
  182. else
  183. expandafter originalmidrule
  184. fi
  185. #1%
  186. }
  187.  
  188.  
  189. % ------- bottomrule -------
  190.  
  191. letoriginalbottomrule=bottomrule
  192.  
  193. defoverlayawarebottomrule<#1>{%
  194. xalt<#1>%
  195. {bottomrule}%
  196. {addlinespace[dimexpr aboverulesep + heavyrulewidth + belowbottomsep relax]}%
  197. }
  198.  
  199. renewcommand{bottomrule}[1]{%
  200. ifx <#1%
  201. expandafter overlayawarebottomrule
  202. else
  203. expandafter originalbottomrule
  204. fi
  205. #1%
  206. }
  207.  
  208.  
  209. % ------- test document -------
  210.  
  211. begin{document}
  212.  
  213. begin{frame}{Example}
  214. begin{table}
  215. begin{tabular}{ll}
  216. toprule
  217. bla & bla \
  218. midrule
  219. A & A \
  220. B & B \
  221. midrule<2->
  222. uncover<2->{C & C} \
  223. uncover<2->{D & D} \
  224. bottomrule
  225. end{tabular}
  226. end{table}
  227.  
  228. uncover<3->{Something else}
  229. end{frame}
  230.  
  231. end{document}
  232.  
  233. defxonly<#1>#2{xalt<#1>{#2}{}}
  234.  
  235. begin{document}
  236.  
  237. begin{frame}{Example}
  238. begin{table}
  239. begin{tabular}{ll}
  240. toprule
  241. bla & bla \
  242. midrule
  243. A & A \
  244. B & B \
  245. xonly<2->{midrule}
  246. xonly<2->{C & C \}
  247. xonly<2->{D & D \}
  248. bottomrule
  249. end{tabular}
  250. end{table}
  251.  
  252. only<3->{Something else}
  253. end{frame}
  254.  
  255. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement