diff --git a/examples/FIR_design.jl b/examples/FIR_design.jl index 1efb82e..2a49c0d 100644 --- a/examples/FIR_design.jl +++ b/examples/FIR_design.jl @@ -51,17 +51,11 @@ end #' Designing a lowpass FIR filter is very simple to do with DSP.jl, all you #' need to do is to define the window length, cut off frequency and the -#' window. - -#' We will define a lowpass filter with cut off frequency at 5Hz for a signal +#' window. We will define a lowpass filter with cut off frequency at 5Hz for a signal #' sampled at 20 Hz. - -#' The Hamming window is defined as: +#' We will use the Hamming window, which is defined as: #' $w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$ -#' The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. -#+ term=true - fs = 20 f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) @@ -70,11 +64,16 @@ h = FIRfreqz(f, w) #' ## Plot the frequency and impulse response +#' The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. +#+ term=true + h_db = log10(abs(h)) ws = w/pi*(fs/2) plot(y = h_db, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)")) +#' And again with default options + h_phase = unwrap(-atan2(imag(h),real(h))) plot(y = h_phase, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Phase (radians)")) diff --git a/src/pandoc.jl b/src/pandoc.jl index 3db7e7e..a04c18e 100644 --- a/src/pandoc.jl +++ b/src/pandoc.jl @@ -23,7 +23,7 @@ function pandoc2html(formatted::AbstractString, doc::WeaveDoc) try #html = @compat readstring( run(pipeline(`echo $formatted` , - `pandoc -R -s --mathjax --self-contained --highlight-style=tango + `pandoc -R -s --mathjax="" --self-contained --highlight-style=tango --template $html_template --include-in-header=$css_template -V wversion=$wversion -V wtime=$wtime -V wsource=$wsource -o $outname`)) @@ -58,7 +58,7 @@ function pandoc2pdf(formatted::AbstractString, doc::WeaveDoc) info("Done executing code. Running xelatex") try run(pipeline(`echo $formatted` , - `pandoc -R -s --self-contained --latex-engine=xelatex --highlight-style=tango + `pandoc -R -s --latex-engine=xelatex --highlight-style=tango --include-in-header=$header_template -V fontsize=12pt -o $outname`)) diff --git a/src/readers.jl b/src/readers.jl index be62321..0f77bb7 100644 --- a/src/readers.jl +++ b/src/readers.jl @@ -183,10 +183,8 @@ function parse_doc(document::AbstractString, format::ScriptInput) haskey(options, :name) || (options[:name] = nothing) state = "code" - continue - - elseif state == "doc" #&& strip(line) != "" && strip(read) != "" + elseif state == "doc" && strip(line) != "" && strip(read) != "" state = "code" (docno > 1) && (read = "\n" * read) # Add whitespace to doc chunk. Needed for markdown output chunk = DocChunk(read, docno, start_line) diff --git a/templates/pandoc_skeleton.css b/templates/pandoc_skeleton.css index 90379cd..769534a 100644 --- a/templates/pandoc_skeleton.css +++ b/templates/pandoc_skeleton.css @@ -1,3 +1,12 @@ + + + +