Skip to content
Snippets Groups Projects
Select Git revision
  • f6467ddf524f22fb69c395685ca6a5d7059c28d3
  • main default protected
2 results

data.bib

Blame
  • protokol.tex 2.25 KiB
    \input ltluatex.tex
    \input luatex85.sty
    \input ucwmac2.tex
    
    \setmargins{15mm}
    \setuppage
    \nopagenumbers
    
    \ucwmodule{luaofs}
    \settextsize{12}
    \baselineskip=18pt
    
    \uselanguage{czech}
    \frenchspacing
    
    \newbox\logobox
    \setbox\logobox=\putimage{width 21mm}{mo-logo.epdf}
    
    \input qrcode.tex
    \qrset{height=23mm, level=H, tight, silent}
    \newbox\codebox
    
    \def\kolo{TODO}
    \def\kat{TODO}
    
    \newbox\ellipsisbox
    \setbox\ellipsisbox=\hbox{\bf~\dots~~}
    
    \directlua{
    	function cut_box(box_nr, max_w)
    		local box = tex.box[box_nr]
    		% nodetree.analyze(box)
    		local n
    		local total_w = 0
    		local last_visible
    		for n in node.traverse(box.head) do
    			local w, h, d = node.dimensions(n, n.next)
    			total_w = total_w + w
    			if total_w > max_w then
    				local new = node.copy_list(box.head, last_visible.next)
    				tex.box[box_nr] = node.hpack(new)
    				% nodetree.analyze(tex.box[box_nr])
    				return
    			end
    			if n.id == 0 or n.id == 2 or n.id == 29 then	% hlist, rule, glyph
    				last_visible = n
    			end
    		end
    	end
    }
    
    \def\limitedbox#1#2{%
    	\setbox0=\hbox{#2}%
    	\ifdim \wd0 > #1\relax
    		\dimen0=\dimexpr #1 - \wd\ellipsisbox\relax
    		\directlua{cut_box(0, tex.dimen[0])}%
    		\setbox0=\hbox{\box0\copy\ellipsisbox}%
    	\fi
    	\box0
    }
    
    \def\field#1#2{\hbox to #1{\limitedbox{#1}{#2}\hss}}
    \def\fillin#1{\smash{\lower 2pt\hbox to #1{\hrulefill}}}
    
    % \proto{kód}{jméno}{třída}{škola}{příklad}
    \def\proto#1#2#3#4#5{
    \setbox\codebox=\hbox{\qrcode{#1}}
    
    \line{%
    	\vhang{\copy\logobox}%
    	\qquad
    	\vhanglines{\baselineskip=14pt\vskip -5pt\hbox{\bf\kolo}\hbox{\bf\kat}}%
    	\hfil
    	\smash{\vhang{\box\codebox}}%
    }
    
    \medskip
    \prevdepth=0pt
    
    \leftline{%
    	\field{0.63\hsize}{Jméno: {\bf #2}}%
    	Třída: {\bf #3}%
    }
    \leftline{%
    	\field{0.63\hsize}{Škola: {\bf #4}}%
    	Příklad: {\bf #5}%
    }
    \leftline{%
    	\field{0.3\hsize}{List {\bf 1} ze \fillin{10mm}}%
    	\field{0.33\hsize}{Hodnotil:}%
    	Bodů:
    }
    
    \bigskip
    \hrule
    \vfill\eject
    }
    
    \def\universal{\proto{MO:*}{}{}{}{}}
    
    \def\blank{%
    \setbox\codebox=\hbox{\qrcode[height=15mm]{MO:+}}
    
    \line{%
    	\field{0.63\hsize}{Jméno:}%
    	\field{0.2\hsize}{Třída:}%
    	\hss
    	\raise\ht\strutbox\hbox{\smash{\vhang{\box\codebox}}}
    }
    \leftline{%
    	\field{0.63\hsize}{List \fillin{10mm} ze \fillin{10mm}}%
    	\field{0.2\hsize}{Příklad:}%
    }
    
    \bigskip
    \nointerlineskip
    \hbox to 0.85\hsize{\hrulefill}
    \vfill\eject
    }