def execute
            latex = compile_latex
            Dir.mktmpdir do | dir |
                @pass_count = 0
                @log        = ''
                success     = false
                while log_suggests_rerunning? && @pass_count < 5
                    @pass_count += 1
                    success = execute_xelatex(latex,dir)
                end
                pdf_file = Pathname.new(dir).join( "output.pdf" )
                if success && pdf_file.exist?
                    yield pdf_file
                else
                    errors = @log.scan(/\*\!\s(.*?)\n\s*\n/m).map{|e| e.first.gsub(/\n/,'') }.join("; ")
                    STDERR.puts @log, errors if ErbLatex.config.verbose_logs
                    raise LatexError.new( errors.empty? ? "xelatex compile error" : errors, @log )
                end
            end
        end
def execute
            latex = compile_latex
            Dir.mktmpdir do | dir |
                @pass_count = 0
                @log        = ''
                success     = false
                while log_suggests_rerunning? && @pass_count < 5
                    @pass_count += 1
                    success = execute_xelatex(latex,dir)
                end
                pdf_file = Pathname.new(dir).join( "output.pdf" )
                if success && pdf_file.exist?
                    yield pdf_file
                else
                    errors = @log.scan(/\*\!\s(.*?)\n\s*\n/m).map{|e| e.first.gsub(/\n/,'') }.join("; ")
                    STDERR.puts @log, errors if ErbLatex.config.verbose_logs
                    raise LatexError.new( errors.empty? ? "xelatex compile error" : errors, @log )
                end
            end
        end
Compile the Latex template into a PDF file
 @yield [Pathname] complete path to the PDF file
 @raise [LatexError] if the xelatex process does not complete successfully