Can I get the output of a command line program with TeX (using e.g. read18)?Test success of write18Per-word...
Error when running ((x++)) as root
French equivalent of the German expression "flöten gehen"
Have the writers and actors of GOT responded to its poor reception?
Pedaling at different gear ratios on flat terrain: what's the point?
Can an airline pilot be prosecuted for killing an unruly passenger who could not be physically restrained?
Driving a school bus in the USA
Good examples of "two is easy, three is hard" in computational sciences
How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?
Divisor Rich and Poor Numbers
Would a "ring language" be possible?
Is it standard to have the first week's pay indefinitely withheld?
Prints each letter of a string in different colors. C#
Largest memory peripheral for Sinclair ZX81?
How to get all possible paths in 0/1 matrix better way?
Why aren't satellites disintegrated even though they orbit earth within earth's Roche Limits?
Is my homebrew Awakened Bear race balanced?
How can sister protect herself from impulse purchases with a credit card?
Taylor series leads to two different functions - why?
Why does Taylor’s series “work”?
What color to choose as "danger" if the main color of my app is red
how to create an executable file for an AppleScript?
Failing students when it might cause them economic ruin
Show that the characteristic polynomial is the same as the minimal polynomial
What animals or plants were used to illustrate ideas of physics?
Can I get the output of a command line program with TeX (using e.g. read18)?
Test success of write18Per-word info needed in DVI to create touch rectangles on LaTeX documents in iTeX for the iPadTeX command with argument BEFORE the commandTeX at the Command LineTikz externalisation not working despite enabling write 18 or shell escapesublimetext 2, auto-pst-pdf, enable shell escape, chemnumHow is the TeX engine informed of the OS's end-of-line marker and file encoding?Combine path from external program with draw in tikzDoes --no-shell-escape break pdf@shellescape?Can't execute jar from directory with umlaut
Say I want to call some external program using write18
, which returns some text to the command line. Can I get that text from inside TeX?
As an example
> inkscape -V
returns the version of the inkscape installation, in my case
Inkscape 0.92.4 (5da689c313, 2019-01-14)
How can I retrieve this information using TeX?
(Note: I am running TeX on Windows, but would like the solution to be system independent.)
tex-core shell-escape command-line
add a comment |
Say I want to call some external program using write18
, which returns some text to the command line. Can I get that text from inside TeX?
As an example
> inkscape -V
returns the version of the inkscape installation, in my case
Inkscape 0.92.4 (5da689c313, 2019-01-14)
How can I retrieve this information using TeX?
(Note: I am running TeX on Windows, but would like the solution to be system independent.)
tex-core shell-escape command-line
1
input|"inkscape -V"
should work.
– egreg
4 hours ago
add a comment |
Say I want to call some external program using write18
, which returns some text to the command line. Can I get that text from inside TeX?
As an example
> inkscape -V
returns the version of the inkscape installation, in my case
Inkscape 0.92.4 (5da689c313, 2019-01-14)
How can I retrieve this information using TeX?
(Note: I am running TeX on Windows, but would like the solution to be system independent.)
tex-core shell-escape command-line
Say I want to call some external program using write18
, which returns some text to the command line. Can I get that text from inside TeX?
As an example
> inkscape -V
returns the version of the inkscape installation, in my case
Inkscape 0.92.4 (5da689c313, 2019-01-14)
How can I retrieve this information using TeX?
(Note: I am running TeX on Windows, but would like the solution to be system independent.)
tex-core shell-escape command-line
tex-core shell-escape command-line
asked 4 hours ago
schtandardschtandard
2,6991121
2,6991121
1
input|"inkscape -V"
should work.
– egreg
4 hours ago
add a comment |
1
input|"inkscape -V"
should work.
– egreg
4 hours ago
1
1
input|"inkscape -V"
should work.– egreg
4 hours ago
input|"inkscape -V"
should work.– egreg
4 hours ago
add a comment |
1 Answer
1
active
oldest
votes
You could use input|"inkscape -V"
(requires -shell-escape
). However, I suggest defining a macro so that you can also manipulate the output:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
begin{document}
inkscapebanner
end{document}
An example of manipulation:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
makeatletter
def@getinkscapeversioninfo#1 #2 #3, #4@nil{%
definkscapeversion{#2}%
definkscapebuild{#3}%
definkscaperelease{#4}%
}
expandafter@getinkscapeversioninfoinkscapebanner@nil
makeatother
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
The mandatory expl3
version:
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
tl_new:N inkscapebanner
tl_new:N inkscapeversion
tl_new:N inkscapebuild
tl_new:N inkscaperelease
sys_shell_get:nnN { inkscape~-V } { char_set_catcode_space:n { `~ } } inkscapebanner
seq_set_split:NnV l_tmpa_seq { ~ } inkscapebanner
tl_set:Nx inkscapeversion { seq_item:Nn l_tmpa_seq { 2 } }
tl_set:Nx inkscapebuild { seq_item:Nn l_tmpa_seq { 3 } }
tl_set:Nx inkscapebuild { tl_range:Nnn inkscapebuild { 1 } { -1 } }
tl_set:Nx inkscaperelease { seq_item:Nn l_tmpa_seq { 4 } }
ExplSyntaxOff
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
Is the fact thatinput|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?
– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
@schtandard You can find it withtexdoc web2c
, section 4.5
– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when askingtexdoc web2c
, but the manual is also available online.)
– schtandard
3 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f491224%2fcan-i-get-the-output-of-a-command-line-program-with-tex-using-e-g-read18%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could use input|"inkscape -V"
(requires -shell-escape
). However, I suggest defining a macro so that you can also manipulate the output:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
begin{document}
inkscapebanner
end{document}
An example of manipulation:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
makeatletter
def@getinkscapeversioninfo#1 #2 #3, #4@nil{%
definkscapeversion{#2}%
definkscapebuild{#3}%
definkscaperelease{#4}%
}
expandafter@getinkscapeversioninfoinkscapebanner@nil
makeatother
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
The mandatory expl3
version:
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
tl_new:N inkscapebanner
tl_new:N inkscapeversion
tl_new:N inkscapebuild
tl_new:N inkscaperelease
sys_shell_get:nnN { inkscape~-V } { char_set_catcode_space:n { `~ } } inkscapebanner
seq_set_split:NnV l_tmpa_seq { ~ } inkscapebanner
tl_set:Nx inkscapeversion { seq_item:Nn l_tmpa_seq { 2 } }
tl_set:Nx inkscapebuild { seq_item:Nn l_tmpa_seq { 3 } }
tl_set:Nx inkscapebuild { tl_range:Nnn inkscapebuild { 1 } { -1 } }
tl_set:Nx inkscaperelease { seq_item:Nn l_tmpa_seq { 4 } }
ExplSyntaxOff
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
Is the fact thatinput|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?
– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
@schtandard You can find it withtexdoc web2c
, section 4.5
– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when askingtexdoc web2c
, but the manual is also available online.)
– schtandard
3 hours ago
add a comment |
You could use input|"inkscape -V"
(requires -shell-escape
). However, I suggest defining a macro so that you can also manipulate the output:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
begin{document}
inkscapebanner
end{document}
An example of manipulation:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
makeatletter
def@getinkscapeversioninfo#1 #2 #3, #4@nil{%
definkscapeversion{#2}%
definkscapebuild{#3}%
definkscaperelease{#4}%
}
expandafter@getinkscapeversioninfoinkscapebanner@nil
makeatother
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
The mandatory expl3
version:
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
tl_new:N inkscapebanner
tl_new:N inkscapeversion
tl_new:N inkscapebuild
tl_new:N inkscaperelease
sys_shell_get:nnN { inkscape~-V } { char_set_catcode_space:n { `~ } } inkscapebanner
seq_set_split:NnV l_tmpa_seq { ~ } inkscapebanner
tl_set:Nx inkscapeversion { seq_item:Nn l_tmpa_seq { 2 } }
tl_set:Nx inkscapebuild { seq_item:Nn l_tmpa_seq { 3 } }
tl_set:Nx inkscapebuild { tl_range:Nnn inkscapebuild { 1 } { -1 } }
tl_set:Nx inkscaperelease { seq_item:Nn l_tmpa_seq { 4 } }
ExplSyntaxOff
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
Is the fact thatinput|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?
– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
@schtandard You can find it withtexdoc web2c
, section 4.5
– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when askingtexdoc web2c
, but the manual is also available online.)
– schtandard
3 hours ago
add a comment |
You could use input|"inkscape -V"
(requires -shell-escape
). However, I suggest defining a macro so that you can also manipulate the output:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
begin{document}
inkscapebanner
end{document}
An example of manipulation:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
makeatletter
def@getinkscapeversioninfo#1 #2 #3, #4@nil{%
definkscapeversion{#2}%
definkscapebuild{#3}%
definkscaperelease{#4}%
}
expandafter@getinkscapeversioninfoinkscapebanner@nil
makeatother
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
The mandatory expl3
version:
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
tl_new:N inkscapebanner
tl_new:N inkscapeversion
tl_new:N inkscapebuild
tl_new:N inkscaperelease
sys_shell_get:nnN { inkscape~-V } { char_set_catcode_space:n { `~ } } inkscapebanner
seq_set_split:NnV l_tmpa_seq { ~ } inkscapebanner
tl_set:Nx inkscapeversion { seq_item:Nn l_tmpa_seq { 2 } }
tl_set:Nx inkscapebuild { seq_item:Nn l_tmpa_seq { 3 } }
tl_set:Nx inkscapebuild { tl_range:Nnn inkscapebuild { 1 } { -1 } }
tl_set:Nx inkscaperelease { seq_item:Nn l_tmpa_seq { 4 } }
ExplSyntaxOff
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
You could use input|"inkscape -V"
(requires -shell-escape
). However, I suggest defining a macro so that you can also manipulate the output:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
begin{document}
inkscapebanner
end{document}
An example of manipulation:
documentclass{article}
usepackage{catchfile}
CatchFileDef{inkscapebanner}{|"inkscape -V"}{}
makeatletter
def@getinkscapeversioninfo#1 #2 #3, #4@nil{%
definkscapeversion{#2}%
definkscapebuild{#3}%
definkscaperelease{#4}%
}
expandafter@getinkscapeversioninfoinkscapebanner@nil
makeatother
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
The mandatory expl3
version:
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
tl_new:N inkscapebanner
tl_new:N inkscapeversion
tl_new:N inkscapebuild
tl_new:N inkscaperelease
sys_shell_get:nnN { inkscape~-V } { char_set_catcode_space:n { `~ } } inkscapebanner
seq_set_split:NnV l_tmpa_seq { ~ } inkscapebanner
tl_set:Nx inkscapeversion { seq_item:Nn l_tmpa_seq { 2 } }
tl_set:Nx inkscapebuild { seq_item:Nn l_tmpa_seq { 3 } }
tl_set:Nx inkscapebuild { tl_range:Nnn inkscapebuild { 1 } { -1 } }
tl_set:Nx inkscaperelease { seq_item:Nn l_tmpa_seq { 4 } }
ExplSyntaxOff
begin{document}
inkscapebannerpar
inkscapeversionpar
inkscapebuildpar
inkscapereleasepar
end{document}
edited 4 hours ago
answered 4 hours ago
egregegreg
742k8919423274
742k8919423274
Is the fact thatinput|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?
– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
@schtandard You can find it withtexdoc web2c
, section 4.5
– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when askingtexdoc web2c
, but the manual is also available online.)
– schtandard
3 hours ago
add a comment |
Is the fact thatinput|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?
– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
@schtandard You can find it withtexdoc web2c
, section 4.5
– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when askingtexdoc web2c
, but the manual is also available online.)
– schtandard
3 hours ago
Is the fact that
input|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?– schtandard
3 hours ago
Is the fact that
input|"inkscape -V"
works a TeX feature or a side effect of its implementation? A search through the TeXbook yielded nothing and this isn't really how I thought the pipe command worked either (since a pipe usually directs output from its left to the command to its right). Why does this work?– schtandard
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
@schtandard It's a “TeX Live addition” added a few years ago.
– egreg
3 hours ago
1
1
@schtandard You can find it with
texdoc web2c
, section 4.5– egreg
3 hours ago
@schtandard You can find it with
texdoc web2c
, section 4.5– egreg
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when asking
texdoc web2c
, but the manual is also available online.)– schtandard
3 hours ago
Thanks for the pointer! (Actually, MiKTeX doesn't find anything when asking
texdoc web2c
, but the manual is also available online.)– schtandard
3 hours ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f491224%2fcan-i-get-the-output-of-a-command-line-program-with-tex-using-e-g-read18%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
input|"inkscape -V"
should work.– egreg
4 hours ago