Guest User

Untitled

a guest
Oct 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. documentclass{book}
  2. usepackage[utf8]{inputenc}
  3. usepackage[T1]{fontenc}
  4. usepackage[english]{babel}
  5. usepackage[]{reledmac}
  6. usepackage{xstring}
  7.  
  8. %%% A dummy macro
  9. newcommand{mymacroA}[1]{textbf{#1}}
  10.  
  11. newcommand{morenoexpands}{%
  12. letmymacroArelax
  13. }%
  14.  
  15. makeatletter
  16. newcommand{truncatelemma}[1]{%
  17. begingroup%
  18. morenoexpands%
  19. normalexpandarg%
  20. StrCount{#1}{ }[@numspaces]%
  21. ifnum@numspaces>5%
  22. noindentignorespaces%
  23. StrBefore[3]{#1}{ }%
  24. ldots{} %
  25. StrBehind[numexpr@numspaces-2relax]{#1}{ }%
  26. else%
  27. noindentignorespaces%
  28. #1%
  29. fi%
  30. endgroup%
  31. }%
  32.  
  33. Xwraplemma[A]{truncatelemma}
  34.  
  35. deffootnoteAnmerkung{@ifstar@footnoteAnmerkung@@footnoteAnmerkung}
  36. newcommand{@@footnoteAnmerkung}[3][]{%
  37. ifcsdef{lemmastart#1}%
  38. {xdef@tempA{#2}%
  39. %%% xpreto vs. gpreto
  40. gpreto{@tempA}{csuse{lemmastart#1} }%
  41. #2%
  42. edtext{}{%
  43. expandafterlemmaexpandafter{@tempA}%
  44. Afootnote{noindentignorespacescsuse{anmtext#1}}%
  45. }%
  46. }%
  47. {edtext{#2}{%
  48. Afootnote{noindentignorespaces#3}%
  49. }%
  50. }%
  51. }%
  52. newcommand{@footnoteAnmerkung}[3][]{%
  53. ifstrempty{#1}%
  54. {% ERROR
  55. }%
  56. {%
  57. #2%
  58. csgdef{lemmastart#1}{#2}%
  59. csgdef{anmtext#1}{#3}%
  60. }%
  61. }%
  62. makeatother
  63.  
  64. begin{document}
  65. beginnumbering
  66. autopar
  67.  
  68. This is footnoteAnmerkung*[N1]{almost the same text}{now we have a
  69. split note} with some text in between and footnoteAnmerkung[N1]{to show the
  70. problem with expansion}{}. That's it.
  71.  
  72. %% Not working with xpreto above
  73. This is footnoteAnmerkung*[N1]{almost mymacroA{the same} text}{now we have a
  74. split note} with some text in between and footnoteAnmerkung[N1]{to show the
  75. problem with expansion}{}. That's it.
  76.  
  77. endnumbering
  78.  
  79. end{document}
Add Comment
Please, Sign In to add comment