Advertisement
Guest User

Test document

a guest
Apr 29th, 2019
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 2.23 KB | None | 0 0
  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[dvipsnames]{xcolor}
  4. \usepackage[style=authoryear-comp]{biblatex}
  5.  
  6. \addbibresource{biblatex-examples.bib}
  7.  
  8. \makeatletter
  9.  
  10. \newcount\testgl
  11. \testgl=0
  12. \begingroup
  13. \obeylines
  14. \long\gdef\test{%
  15.   \begingroup
  16.     \testgl=1 %
  17.     \obeylines\@test}
  18. \long\gdef\@test^^M#1^^M#2^^M{%
  19.     \ttfamily%
  20.     \def\scr@tch{}%
  21.     #1\par%
  22.     \color{Red}#2 %
  23.     \ifnum\pdfstrcmp{\expandafter\trimspaces\expandafter{\scr@tch}}{\strip@ltr#2}=0 %
  24.       \color{Green}OK!%
  25.     \else%
  26.       \color{Red}No :/%
  27.     \fi\par%
  28.     \hrulefill%
  29.     \gdef\scr@tch{}%
  30.   \endgroup%
  31. }
  32. \endgroup
  33. \def\trimspaces#1{%
  34.   \if\relax\detokenize{#1}\relax
  35.    \expandafter\@gobble
  36.  \else
  37.    \expandafter\strip@trailing@spaces
  38.  \fi
  39.  {#1}}
  40. \def\strip@ltr#1 {}
  41. \def\tmpa#1{%
  42.   \def\strip@trailing@spaces##1{%
  43.     \strip@trailing##1\qnil\strip@trailing#1\qnil\strip@qnil}}
  44. \tmpa{ }
  45. \def\strip@qnil#1\qnil#2\qnil#3{#1}
  46. \def\strip@trailing#1 \qnil#2{%
  47.   #2#1\qnil\strip@trailing}
  48.  
  49. \def\scr@tch{}%
  50.  
  51. \renewbibmacro*{cite}{%
  52.   \edef\tmpa{%
  53.   (\the\numexpr\currentgrouplevel-\testgl\relax)%
  54.   <\the\value{overallcitecount}/\the\value{overallcitetotal}>%
  55.   [\the\value{citecount}/\the\value{citetotal}] }\tmpa
  56.  \xdef\scr@tch{\scr@tch\tmpa}}
  57.  
  58. \usepackage{unravel}
  59. \unravelsetup{
  60. max-action =  500,
  61. max-output = 3000,
  62. max-input  = 3000,
  63. }
  64.  
  65. \begin{document}
  66. % leaking counts with \cite (probably the smuggling?)
  67.  
  68. \test
  69. A \cite{sigfridsson,worman,nussbaum}
  70. A (3)<1/3>[1/3] (3)<2/3>[2/3] (3)<3/3>[3/3]
  71.  
  72. \test
  73. B \cite{sigfridsson}
  74. B (3)<1/1>[1/1]
  75.  
  76. \test
  77. C \cites{sigfridsson,sigfridsson}
  78. C (5)<1/1>[1/1]
  79.  
  80. \test
  81. D \cites{sigfridsson}{worman}
  82. D (5)<1/2>[1/1] (5)<2/2>[1/1]
  83.  
  84. \test
  85. D \cites{sigfridsson,sigfridsson}{worman,sigfridsson}
  86. D (5)<1/3>[1/1] (5)<2/3>[1/2] (5)<3/3>[2/2]
  87.  
  88. \test
  89. E \cites{sigfridsson,sigfridsson}
  90. E (5)<1/1>[1/1]
  91.  
  92. \test
  93. A \cites{sigfridsson}{worman}{geer}
  94. A (5)<1/3>[1/1] (5)<2/3>[1/1] (5)<3/3>[1/1]
  95.  
  96. \test
  97. B \cite{sigfridsson}
  98. B (3)<1/1>[1/1]
  99.  
  100. \test
  101. C \cite{sigfridsson,worman}
  102. C (3)<1/2>[1/2] (3)<2/2>[2/2]
  103.  
  104. \test
  105. D \cite{sigfridsson}
  106. D (3)<1/1>[1/1]
  107.  
  108. \test
  109. A \cites{sigfridsson,worman,sigfridsson}
  110. A (5)<1/2>[1/2] (5)<2/2>[2/2]
  111.  
  112. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement