diff --git a/Makefile b/Makefile index d02a724cc08db8dfc1e7872c7d9de465d12a627c..fff4becc77f4a90667b2be9b257a8febcee421c7 100644 --- a/Makefile +++ b/Makefile @@ -3,48 +3,56 @@ NAME = test LATEX = pdflatex BIBTEX = biber -SUBDIRS = svg plt crc -OUTDIR = build -TEX_FLAGS = -file-line-error -interaction=nonstopmode -COM_FLAGS = -output-directory=$(OUTDIR) -quiet -GARBAGE_PATTERNS = *.aux *.bbl *.bib *.bcf *.blg *.idx *.ind *.lof *.lot *.log *.xml *.toc +# OUTDIR needs to be at least this, can not be empty: +OUTDIR = . +AUXDIR = .aux +IGNORE = src/% +GARBAGE_PATTERNS = *.aux *.bbl *.bib *.bcf *.blg *.idx *.ind *.lof *.lot *.log *.xml *.toc *.synctex(busy) *.synctex.gz(busy) -SUB_TEX_FILES = $(foreach D,$(SUBDIRS),$(wildcard $(D)/*.tex)) -SUB_PDF_FILES = $(join $(dir $(SUB_TEX_FILES)),$(addprefix $(OUTDIR)/,$(notdir $(SUB_TEX_FILES:tex=pdf)))) -SUB_SVG_FILES = $(foreach D,$(SUBDIRS),$(wildcard $(D)/*.svg)) -SUB_PDF_TEX_FILES = $(join $(dir $(SUB_SVG_FILES)),$(addprefix $(OUTDIR)/,$(notdir $(SUB_SVG_FILES:svg=pdf)))) -GARBAGE = $(foreach D,. $(SUBDIRS), $(wildcard $(addprefix $(D)/$(OUTDIR)/,$(GARBAGE_PATTERNS)))) +# comment this out to get all outputs: +QUIET = -quiet +TEX_FLAGS = -file-line-error -interaction=nonstopmode -aux-directory=$(dir $@)$(OUTDIR)/$(AUXDIR) -output-directory=$(dir $@)$(OUTDIR) +# this grabs all subfiles it can find +SUB_TEX_FILES = $(filter-out $(IGNORE),$(wildcard **/*.tex)) +SUB_SVG_FILES = $(filter-out $(IGNORE),$(wildcard **/*.svg)) +# and makes a big list of prerequisits +SUB_FILES = $(SUB_TEX_FILES:tex=pdf) $(SUB_SVG_FILES:svg=pdf_tex) + +# get src folder on include path export TEXINPUTS:=$(CURDIR)\src -all: bib - $(LATEX) $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex - $(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex - copy /Y $(OUTDIR)\$(NAME).pdf .\ -bib: $(NAME).pdf $(OUTDIR)\$(NAME).bcf - $(BIBTEX) $(COM_FLAGS) $(NAME) +all: pdf bib + $(LATEX) $(TEX_FLAGS) $(QUIET) $(NAME).tex + $(LATEX) -synctex=1 $(TEX_FLAGS) $(QUIET) $(NAME).tex -$(OUTDIR)\$(NAME).bcf: - $(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex +pdf: $(SUB_FILES) $(NAME).pdf -pdf: $(NAME).pdf +bib: $(OUTDIR)/$(AUXDIR)/$(NAME).bcf + $(BIBTEX) -output-directory=$(OUTDIR)/$(AUXDIR) $(QUIET) $(NAME) -$(NAME).pdf: $(NAME).tex $(SUB_PDF_FILES) $(SUB_PDF_TEX_FILES) - $(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex +# generel latex call +%.pdf: %.tex + $(LATEX) $(TEX_FLAGS) $(QUIET) $*.tex -$(SUB_PDF_FILES): $(SUB_TEX_FILES) - cd $(subst $(OUTDIR)/,,$(dir $@)) && $(LATEX) $(TEX_FLAGS) $(COM_FLAGS) $(notdir $(@:pdf=tex)) +# generell inkscape call +%.pdf_tex: %.svg + inkscape -C --export-latex $*.svg -o $*.pdf -$(SUB_PDF_TEX_FILES): $(SUB_SVG_FILES) - cd $(subst $(OUTDIR)/,,$(dir $@)) && inkscape -C --export-latex $(notdir $(@:pdf=svg)) -o $(and $(OUTDIR),$(OUTDIR)\)$(notdir $@) +# little hack if temp files are not present +%.bcf: $(NAME).tex + if exist $(NAME).pdf del $(NAME).pdf + $(MAKE) pdf +# These are NOT portable!! clean: tidy - for %%a in ($(foreach D,$(subst /,\,$(SUB_PDF_FILES) $(SUB_PDF_TEX_FILES)) $(subst pdf,synctex.gz,$(subst /,\,$(SUB_PDF_FILES))) $(subst pdf,pdf_tex,$(subst /,\,$(SUB_PDF_TEX_FILES))) $(OUTDIR)\$(NAME).pdf $(OUTDIR)\$(NAME).synctex.gz, "$(D)")) do if exist %%~a del /q %%~a - for %%a in ($(foreach D,. $(SUBDIRS),"$(D)\$(if $(subst .,,$(OUTDIR)),$(OUTDIR),build)")) do if exist %%~a rmdir /s /q %%~a -# if exist $(NAME).pdf del $(NAME).pdf + for %%a in ($(subst /,\,$(SUB_FILES) $(SUB_SVG_FILES:svg=pdf))) do if exist %%~a del /s/q %%~a + if exist $(OUTDIR)\$(NAME).synctex.gz del $(OUTDIR)\$(NAME).synctex.gz + if exist $(OUTDIR)\$(NAME).pdf del $(OUTDIR)\$(NAME).pdf tidy: - if exist $(or $(word 1, $(subst /,\,$(GARBAGE))), false) del /q $(subst /,\,$(GARBAGE)) + for %%a in ($(OUTDIR)\$(AUXDIR) $(subst /,\,$(wildcard **/$(AUXDIR)))) do if exist %%~a rmdir /s/q %%~a + for %%a in ("$(wildcard $(GARBAGE_PATTERNS))") do if exist %%~a del /s/q %%~a diff --git a/crc/exampleCircuit.pdf b/crc/exampleCircuit.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d2074d804712b8f2a68079bb4f3629891493e12c Binary files /dev/null and b/crc/exampleCircuit.pdf differ diff --git a/plt/examplePlot.pdf b/plt/examplePlot.pdf new file mode 100644 index 0000000000000000000000000000000000000000..86d02bc8647d984e36a3c96fee2e3e3af715a0db Binary files /dev/null and b/plt/examplePlot.pdf differ diff --git a/svg/exampleSVG.pdf b/svg/exampleSVG.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cb71c5bdc1ed0449d19217d2efc814b8a997aba5 --- /dev/null +++ b/svg/exampleSVG.pdf @@ -0,0 +1,69 @@ +%PDF-1.5 +%���� +4 0 obj +<< /Length 5 0 R + /Filter /FlateDecode +>> +stream +x�m��i1F�B Dѯ-��B`7��!I��ށ����>?���{���|�����s��w��oSE�P8�0B�t�S��{�g�h�9����V�լ�8�/��V&\.8}Z9�0`J�Y1�nɂ]x�z�G��e�ʕ�TN�QiS�B�-Y�//�u��|�f$�%�� p.�*"�����`Os��a{�T�=�����-��8}�n^��csX�e�vko�@!c[ +endstream +endobj +5 0 obj + 233 +endobj +3 0 obj +<< + /ExtGState << + /a0 << /CA 1 /ca 1 >> + >> +>> +endobj +2 0 obj +<< /Type /Page % 1 + /Parent 1 0 R + /MediaBox [ 0 0 69.075493 34.604038 ] + /Contents 4 0 R + /Group << + /Type /Group + /S /Transparency + /I true + /CS /DeviceRGB + >> + /Resources 3 0 R +>> +endobj +1 0 obj +<< /Type /Pages + /Kids [ 2 0 R ] + /Count 1 +>> +endobj +6 0 obj +<< /Producer (cairo 1.16.0 (https://cairographics.org)) + /Creator <FEFF0049006E006B0073006300610070006500200031002E00300020002800680074007400700073003A002F002F0069006E006B00730063006100700065002E006F007200670029> + /CreationDate (D:20210411142101+02'00) +>> +endobj +7 0 obj +<< /Type /Catalog + /Pages 1 0 R +>> +endobj +xref +0 8 +0000000000 65535 f +0000000649 00000 n +0000000419 00000 n +0000000347 00000 n +0000000015 00000 n +0000000325 00000 n +0000000714 00000 n +0000000989 00000 n +trailer +<< /Size 8 + /Root 7 0 R + /Info 6 0 R +>> +startxref +1041 +%%EOF diff --git a/svg/exampleSVG.pdf_tex b/svg/exampleSVG.pdf_tex new file mode 100644 index 0000000000000000000000000000000000000000..ae3933597129b1eae47eddc0e87bd95d6a87f951 --- /dev/null +++ b/svg/exampleSVG.pdf_tex @@ -0,0 +1,61 @@ +%% Creator: Inkscape 1.0 (4035a4fb49, 2020-05-01), www.inkscape.org +%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 +%% Accompanies image file 'exampleSVG.pdf' (pdf, eps, ps) +%% +%% To include the image in your LaTeX document, write +%% \input{<filename>.pdf_tex} +%% instead of +%% \includegraphics{<filename>.pdf} +%% To scale the image, write +%% \def\svgwidth{<desired width>} +%% \input{<filename>.pdf_tex} +%% instead of +%% \includegraphics[width=<desired width>]{<filename>.pdf} +%% +%% Images with a different path to the parent latex file can +%% be accessed with the `import' package (which may need to be +%% installed) using +%% \usepackage{import} +%% in the preamble, and then including the image with +%% \import{<path to file>}{<filename>.pdf_tex} +%% Alternatively, one can specify +%% \graphicspath{{<path to file>/}} +%% +%% For more information, please see info/svg-inkscape on CTAN: +%% http://tug.ctan.org/tex-archive/info/svg-inkscape +%% +\begingroup% + \makeatletter% + \providecommand\color[2][]{% + \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}% + \renewcommand\color[2][]{}% + }% + \providecommand\transparent[1]{% + \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}% + \renewcommand\transparent[1]{}% + }% + \providecommand\rotatebox[2]{#2}% + \newcommand*\fsize{\dimexpr\f@size pt\relax}% + \newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}% + \ifx\svgwidth\undefined% + \setlength{\unitlength}{69.07548919bp}% + \ifx\svgscale\undefined% + \relax% + \else% + \setlength{\unitlength}{\unitlength * \real{\svgscale}}% + \fi% + \else% + \setlength{\unitlength}{\svgwidth}% + \fi% + \global\let\svgwidth\undefined% + \global\let\svgscale\undefined% + \makeatother% + \begin{picture}(1,0.50095973)% + \lineheight{1}% + \setlength\tabcolsep{0pt}% + \put(0,0){\includegraphics[width=\unitlength,page=1]{exampleSVG.pdf}}% + \put(0.60542618,0.3725692){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$Z_1$\end{tabular}}}}% + \put(0.28648163,0.04406763){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$Z_{1.1}$\end{tabular}}}}% + \put(0.30435055,0.30606594){\color[rgb]{0,0,0}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}$Z_{1.2}$\end{tabular}}}}% + \end{picture}% +\endgroup% diff --git a/test.pdf b/test.pdf index da86454efdc2f101c99f3f5c35aff1ba5da85c96..83060365594a3a0c59ee216e37ca301ce39d3baa 100644 Binary files a/test.pdf and b/test.pdf differ diff --git a/test.tex b/test.tex index 886cdf2847ca748224ccf0ae46e9db13b076f53e..41ba96ddd98eaafdd1e9f75fa49003442c4210c4 100644 --- a/test.tex +++ b/test.tex @@ -57,21 +57,21 @@ \pagebreak \begin{figure} \centering - \includegraphics[width=0.6\textwidth, page=2]{plt/build/examplePlot.pdf} + \includegraphics[width=0.6\textwidth, page=2]{plt/examplePlot.pdf} \caption{a nice plot} \end{figure} \begin{figure} \centering - \includegraphics{crc/build/exampleCircuit.pdf} + \includegraphics{crc/exampleCircuit.pdf} \caption{a circuit diagramm} \end{figure} \makeatletter \begin{figure} - \graphicspath{{svg/build/}} % double curly brackets needet for unknown reason - \input{svg/build/exampleSVG.pdf_tex} + \graphicspath{{svg/}} % double curly brackets needet for unknown reason + \input{svg/exampleSVG.pdf_tex} \caption{made via inkscape} \end{figure}