How to process latex / tikz-timing diagrams in a PowerShell pipe? -
i have several tikz-timing diagrams compile wrapper latex file. wrapper uses latex package standalone produce pdf , png file. spare these wrapper files , replace them one. additionally, pipe list of filenames powershell function, processes each waveform tex file general wrapper file.
more in detail:
waveform.tex
wrapper tex file, has placeholder in \input{...}
macro. placeholder replaced powershell script.
\documentclass[convert={density=600,size=2000x800,outext=.png}]{standalone} \usepackage[utf8]{inputenc} % utf-8 tex file input incoding \usepackage[t1]{fontenc} % type1 font encoding \usepackage[ngerman]{babel} % new german writing rules; must loaded before microtype \usepackage{courier} % set courier font default teletype writer (texttt, ttfamily, ...) \usepackage[usenames,svgnames,table]{xcolor} % load colors , color-names \usepackage{pgf} % primitive drawing library \usepackage{tikz} % pgf frontend, drawing macros \usepackage{tikz-timing} % spezial tikz library waveform/timing diagrams \usetikztiminglibrary{nicetabs} % sublibrary better looking timingtables \begin{document} \input{%%waveformfile%%} %\input{iiccontroller} % uncomment if timing-diagram fixed file name \end{document}
iiccontroller.tex example waveform:
% \tikztimingmetachar{a}[1]{#1{z[black]};} % \begin{tikztimingtable}[ timing/table/header/.style={font=\bf}, timing/wscale=2, timing/nice tabs, ] master\_busrequest & l h h 4h 4h 4h 4h l \\ master\_busgrant & l l h 4h 4h 4h 4h l \\ master\_busabort & l l l 4l 4l 4l 4l l \\ master\_wp\_valid & l l l 4h 4h 4h 4h l \\ master\_wp\_data & a 4d{phy adr + r/w} 4d{reg adr} 4d{d0.0} 4d{d0.1} \\ master\_wp\_last & l l l 4l 4l 4l 4h l \\ master\_wp\_ack & l l l 3lh 3lh 3lh 3lh l \\ \extracode \tableheader{signalname}{signalverlauf} \tablerules \begin{background}[shift={(0.1,0)},help lines] \vertlines{0,2,...,40} \end{background} \end{tikztimingtable}
and finally, here powershell script:
function compile-waveform { [cmdletbinding()]param( [parameter( mandatory=$true, position=0, valuefrompipeline=$true, valuefrompipelinebypropertyname=$true)] [string[]]$inputfiles ) begin { $wrapperfile = "waveform.tex" $wrappercontent = get-content -path $wrapperfile -encoding ascii -raw } process { #write-host "wrappercontent" -foregroundcolor green #write-host $wrappercontent -foregroundcolor gray #write-host "" foreach($inputfile in $inputfiles) { write-host "processing file: '$inputfile'" -foregroundcolor yellow $outputfile = [string]$inputfile.replace(".tex", ".png") $temp = $wrappercontent -replace "%%waveformfile%%",$inputfile #write-host "temp" -foregroundcolor green #write-host $temp -foregroundcolor gray #write-host "" write-output $temp | & 'c:\program files\miktex 2.9\miktex\bin\x64\pdflatex.exe' -shell-escape -time-statistics -synctex=1 -interaction=nonstopmode } } }
how use script?
navigate folder of iiccontroller.tex
. source *.ps1 file , pipe found waveform files powershell function:
cd d:\temp\waveform . compile.ps1 dir iiccontroller.tex | compile-waveform
now pdflatex print error log:
processing file: 'd:\git\satacontroller\doc\waveforms\simple.tex' pdftex, version 3.14159265-2.6-1.40.15 (miktex 2.9 64-bit) **entering extended mode latex2e <2014/05/01> babel <3.9l> , hyphenation patterns 68 languages loaded. ! emergency stop. <*> ...600,size=2000x800,outext=.png}]{standalone} ! ==> fatal error occurred, no output pdf file produced! transcript written on texput.log. gross execution time: 26 ms user mode: 0 ms, kernel mode: 15 ms, total: 15
puttex.log
has same content console output.
has idea happening?
if run wavefom.tex fixed filename (see second \input
line) in powershell, works fine.
Comments
Post a Comment