LaTeX forum ⇒ GeneralTexnicCenter & \write18 VS. Windows command line Topic is solved

General information and discussion about TeXnicCenter
Posts: 2
Joined: Thu Jun 23, 2022 3:16 pm

TexnicCenter & \write18 VS. Windows command line

Postby juk80 » Thu Jun 23, 2022 3:59 pm

Hi everybody,

What is the difference/are there restrictions when
1. pdfcrop.exe is run from within TexnicCenter via pdflatex output profile with -enable-write18
2. pdfcrop.exe is run from Windows command line
3. tex file in 1. is run from Windows command line via pdflatex -enable-write18

I tried to use auto-pst-pdf to include pstricks in pdflatex but could not make it work - Latex => PS => PDF is too damn slow! During error search I realised that pdfcrop fails during auto-pst-pdf execution. Thus the following minimal example (without use of auto-pst-pdf, instead focus on execution of pdfcrop):

1. Crop from within TexnicCenter using the following example code (output profile pdflatex -enable-write18):

\usepackage{shellesc} %alternative to write18

% name of pic in main path

	% check shell escape status
	Shell escape 

	% pdfcrop via write18 -> exe
	\immediate\write18{pdfcrop.exe --verbose "\picname"}
	% alternative: via write18 -> perl call
%	\immediate\write18{perl "C:/Program Files/MiKTeX/scripts/pdfcrop/" --verbose "\picname"}
	% alternative: via ShellEscape -> exe
%	\ShellEscape{pdfcrop.exe --verbose "\picname"}
`		\caption{uncropped}

2. Crop with pdfcrop.exe on Windows command line:
> pdfcrop.exe fig_appMinkowskiBasis3d

3. Compile tex file in 1. directly on Windows command line:
> pdflatex -enable-write18 PicTest.tex

2. & 3. work just fine (see result pdf)
1. does not work (somewhat similar to the auto-pst-pdf situation), console log:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=pdflatex 2022.6.22)  23 JUN 2022 15:49
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
LaTeX2e <2022-06-01> pre-release-0 (develop 2022-6-22 branch)
L3 programming layer <2022-06-02>
(C:\Program Files\MiKTeX\tex/latex/base\article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(C:\Program Files\MiKTeX\tex/latex/base\size10.clo
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
(C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)

(C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
(C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)

(C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
Package graphics Info: Driver file: pdftex.def on input line 107.

(C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
(C:\Program Files\MiKTeX\tex/latex/pstool\pstool.sty
Package: pstool 2018/01/20 v1.5e Wrapper for processing PostScript/psfrag figur

(C:\Program Files\MiKTeX\tex/generic/catchfile\catchfile.sty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)

(C:\Program Files\MiKTeX\tex/generic/infwarerr\infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
(C:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
(C:\Program Files\MiKTeX\tex/generic/etexcmds\etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)

(C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
(C:\Program Files\MiKTeX\tex/latex/graphics\color.sty
Package: color 2022/01/06 v1.3d Standard LaTeX Color (DPC)

(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
Package color Info: Driver file: pdftex.def on input line 149.

(C:\Program Files\MiKTeX\tex/latex-dev/graphics\mathcolor.ltx))
(C:\Program Files\MiKTeX\tex/generic/iftex\ifpdf.sty
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
(C:\Program Files\MiKTeX\tex/latex/ifplatform\ifplatform.sty
Package: ifplatform 2017/10/13 v0.4a Testing for the operating system

(C:\Program Files\MiKTeX\tex/latex/tools\shellesc.sty
Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
Package shellesc Info: Unrestricted shell escape enabled on input line 75.
(C:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
(C:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
(C:\Program Files\MiKTeX\tex/latex/filemod\filemod.sty
Package: filemod 2011/09/19 v1.2 Get and compare file modification times

(C:\Program Files\MiKTeX\tex/latex/filemod\filemod-expmin.sty
Package: filemod-expmin 2011/09/19 v1.2 Get and compare file modification times
 (expandable; minimal)
(C:\Program Files\MiKTeX\tex/latex/psfrag\psfrag.sty
Package: psfrag 1998/04/11 v3.04 PSfrag (MCG)
(C:\Program Files\MiKTeX\tex/latex/bigfoot\suffix.sty
Package: suffix 2006/07/15 1.5a Variant command support
(C:\Program Files\MiKTeX\tex/latex/trimspaces\trimspaces.sty
Package: trimspaces 2009/09/17 v1.1 Trim spaces around a token list
(C:\Program Files\MiKTeX\tex/latex/xkeyval\xkeyval.sty
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)

(C:\Program Files\MiKTeX\tex/generic/xkeyval\xkeyval.tex
(C:\Program Files\MiKTeX\tex/generic/xkeyval\xkvutils.tex
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
(C:\Program Files\MiKTeX\tex/latex/l3kernel\expl3.sty
Package: expl3 2022-06-02 L3 programming layer (loader) 

(C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def
File: l3backend-pdftex.def 2022-04-20 L3 backend support: PDF output (pdfTeX)
runsystem(cd ""& copy "PicTest.aux" "PicTest.oldaux" )...executed.

(C:\Program Files\MiKTeX\tex/latex/pdfpages\pdfpages.sty
Package: pdfpages 2022/05/22 v0.5v Insert pages of external PDF documents (AM)

(C:\Program Files\MiKTeX\tex/latex/base\ifthen.sty
Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
(C:\Program Files\MiKTeX\tex/latex/tools\calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
(C:\Program Files\MiKTeX\tex/latex/eso-pic\eso-pic.sty
Package: eso-pic 2020/10/14 v3.0a eso-pic (RN)

(C:\Program Files\MiKTeX\tex/latex/pdfpages\pppdftex.def
File: pppdftex.def 2022/05/22 v0.5v Pdfpages driver for pdfTeX (AM)
) (PicTest.aux)
\openout1 = `PicTest.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.

(C:\Program Files\MiKTeX\tex/context/base/mkii\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (C:\Program Files\MiKTeX\tex/latex/epstopdf-pkg\epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4

(C:\Program Files\MiKTeX\tex/latex/00miktex\epstopdf-sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
(C:\Program Files\MiKTeX\tex/latex/pdflscape\pdflscape.sty
Package: pdflscape 2019/12/05 v0.12 Display of landscape pages in PDF (HO)

(C:\Program Files\MiKTeX\tex/latex/graphics\lscape.sty
Package: lscape 2020/05/28 v3.02 Landscape Pages (DPC)
Package pdflscape Info: Auto-detected driver: pdftex on input line 81.
runsystem(pdfcrop.exe --verbose "fig_appMinkowskiBasis3d")...executed.

pdfTeX warning: pdflatex.exe (file ./fig_appMinkowskiBasis3d.pdf): PDF inclusio
n: found PDF version <1.7>, but at most version <1.5> allowed
<fig_appMinkowskiBasis3d.pdf, id=1, page=1, 233.87375pt x 121.45375pt>
File: fig_appMinkowskiBasis3d.pdf Graphic file (type pdf)
<use fig_appMinkowskiBasis3d.pdf, page 1>
Package pdftex.def Info: fig_appMinkowskiBasis3d.pdf , page1 used on input line
(pdftex.def)             Requested size: 155.24895pt x 80.62671pt.

! LaTeX Error: File `fig_appMinkowskiBasis3d-crop' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.52 		}

Something must go on (RESTRICTION?, ENVIRONMENT VARIABLES?, ...) when running pdfcrop.exe from within TexnicCenter via \write18 in contrast to Windows Command Line, but I cannot find any forum entries or man pages on that.

Any ideas would be greatly appreciated!

SETUP (all current as of today):
- Windows 10
- MikTex basic-miktex-22.3-x64.exe
- TexnicCenter 2.02stable
- attached files:
-> image to be cropped: fig_appMinkowskiBasis3d.pdf
-> minimal tex file for 1. and 3.: PicTest.tex
-> result from 3.: PicTest.pdf

Thx in advance, Jens
(1.15 KiB) Downloaded 8 times
(92.23 KiB) Downloaded 11 times
(15.75 KiB) Downloaded 13 times

Recommended reading 2021: •
LaTeX Beginner's Guide LaTeX Cookbook
Posts: 2
Joined: Thu Jun 23, 2022 3:16 pm

TexnicCenter & \write18 VS. Windows command line  Topic is solved

Postby juk80 » Wed Jun 29, 2022 5:23 pm

Hi again,

I found a workaround - in case someone encounters the same issue.

Apperently, pdfcrop requires console output from Ghostscript which is not provided in write18

\immediate\write18{start /wait pdfcrop.exe --verbose \picname && exit}
Instead of just running pdfcrop, run pdfcrop in a new command line window ("start /wait") and close it when done.

Kind regards,


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest