Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. documentclass[12pt]{article}
  2.  
  3. usepackage{tikz}
  4. usepackage{etoolbox}
  5.  
  6. newcommand{specialsave}[1]{
  7. pgfkeys{
  8. /specialstore/place/.cd,
  9. a/.initial,
  10. c/.initial,#1, % there cannot be a newline before #1
  11. c/.get=cvalA, % this must come after #1, otherwise it won't get the values that are set
  12. }
  13.  
  14. edefcvalB{pgfkeysvalueof{/specialstore/place/c}}
  15. defcompareval{pgfkeysnovalue}
  16. ifdefequal{cvalA}{compareval}{c is empty by comparison A}{c is non-empty by comparison A}
  17.  
  18. ifdefequal{cvalB}{compareval}{c is empty by comparison B}{c is non-empty by comparison B}
  19. }
  20. begin{document}
  21. specialsave{
  22. a=the values of a,
  23. }
  24. \
  25.  
  26. specialsave{
  27. a=the values of a,
  28. c
  29. }
  30. \
  31.  
  32. specialsave{
  33. a=the values of a,
  34. c=
  35. }
  36. \
  37.  
  38. specialsave{
  39. a=the values of a,
  40. c={}
  41. }
  42. end{document}
  43.  
  44. c is empty by comparison A
  45. c is non-empty by comparison B
  46.  
  47. c is empty by comparison A
  48. c is non-empty by comparison B
  49.  
  50. c is non-empty by comparison A
  51. c is non-empty by comparison B
  52.  
  53. c is non-empty by comparison A
  54. c is non-empty by comparison B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement