Gnuplottex: Pass latex command to gnuplot script The 2019 Stack Overflow Developer Survey Results Are InLaTex variable inside gnuplot codeAccelerating LaTeX packages using a make like functionalityReading and (custom) formatting a CSV (not csvautotabular)How to use gnuplottex?A gnuplottex filename issueGnuplottex is not workingGnuplottex axis formatGnuplottex font size to whole graphGnuplottex not working in TeXstudioGnuplottex and subfiguresUse GnuPlot with latex

Why can't devices on different VLANs, but on the same subnet, communicate?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Does HR tell a hiring manager about salary negotiations?

Inverse Relationship Between Precision and Recall

How to obtain a position of last non-zero element

What do these terms in Caesar's Gallic wars mean?

Keeping a retro style to sci-fi spaceships?

I am an eight letter word. What am I?

Can I have a signal generator on while it's not connected?

What is this business jet?

Likelihood that a superbug or lethal virus could come from a landfill

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Slides for 30 min~1 hr Skype tenure track application interview

Can we generate random numbers using irrational numbers like π and e?

Why doesn't UInt have a toDouble()?

What's the name of these plastic connectors

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Match Roman Numerals

Does adding complexity mean a more secure cipher?

Can there be female White Walkers?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

What is preventing me from simply constructing a hash that's lower than the current target?

Why does the nucleus not repel itself?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?



Gnuplottex: Pass latex command to gnuplot script



The 2019 Stack Overflow Developer Survey Results Are InLaTex variable inside gnuplot codeAccelerating LaTeX packages using a make like functionalityReading and (custom) formatting a CSV (not csvautotabular)How to use gnuplottex?A gnuplottex filename issueGnuplottex is not workingGnuplottex axis formatGnuplottex font size to whole graphGnuplottex not working in TeXstudioGnuplottex and subfiguresUse GnuPlot with latex










0















I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position relative to the two documents. To re-use as much code as possible, I would like to define the relative path to the data in each document in a macro, here datapath.



My question is: How can I pass the value of this command to the gnuplot script? I would basically like to use the following in my MWE:



plot datapath'/data.csv' using 1:2 with lines


I did find this thread. However I was unable to modify it to my needs. Can someone help me, please?




MWE



documentclassarticle

usepackage[latin1]inputenx
usepackagefilecontents
usepackage[
miktex, %
subfolder, % generated graphs in a ”gnuplottex” subfolder
cleanup, % Delete the .gnuplot files after conversion
]gnuplottex

newcommanddatapath./ZZZ

begindocument

% This is the data file to be plotted from
beginfilecontents*datapath/data.csv
Col1,Col2
0,0
1,1
endfilecontents*

% This is the gnuplot script I would like to use the value of datapath in
beginfilecontents*datapath/script.gnuplot
set key autotitle columnhead
set datafile separator "," # for csv-file
plot './ZZZ/data.csv' using 1:2 with lines
endfilecontents*

beginfigure[htbp]
centering
gnuplotloadfile[terminal=cairolatex]datapath/script.gnuplot
endfigure

enddocument









share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Your MWE works fine for me on Linux with pdflatex.

    – Lars Kotthoff
    Feb 15 '18 at 17:22











  • Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

    – krtek
    Feb 15 '18 at 17:30











  • See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

    – egreg
    Feb 15 '18 at 18:25
















0















I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position relative to the two documents. To re-use as much code as possible, I would like to define the relative path to the data in each document in a macro, here datapath.



My question is: How can I pass the value of this command to the gnuplot script? I would basically like to use the following in my MWE:



plot datapath'/data.csv' using 1:2 with lines


I did find this thread. However I was unable to modify it to my needs. Can someone help me, please?




MWE



documentclassarticle

usepackage[latin1]inputenx
usepackagefilecontents
usepackage[
miktex, %
subfolder, % generated graphs in a ”gnuplottex” subfolder
cleanup, % Delete the .gnuplot files after conversion
]gnuplottex

newcommanddatapath./ZZZ

begindocument

% This is the data file to be plotted from
beginfilecontents*datapath/data.csv
Col1,Col2
0,0
1,1
endfilecontents*

% This is the gnuplot script I would like to use the value of datapath in
beginfilecontents*datapath/script.gnuplot
set key autotitle columnhead
set datafile separator "," # for csv-file
plot './ZZZ/data.csv' using 1:2 with lines
endfilecontents*

beginfigure[htbp]
centering
gnuplotloadfile[terminal=cairolatex]datapath/script.gnuplot
endfigure

enddocument









share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Your MWE works fine for me on Linux with pdflatex.

    – Lars Kotthoff
    Feb 15 '18 at 17:22











  • Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

    – krtek
    Feb 15 '18 at 17:30











  • See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

    – egreg
    Feb 15 '18 at 18:25














0












0








0








I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position relative to the two documents. To re-use as much code as possible, I would like to define the relative path to the data in each document in a macro, here datapath.



My question is: How can I pass the value of this command to the gnuplot script? I would basically like to use the following in my MWE:



plot datapath'/data.csv' using 1:2 with lines


I did find this thread. However I was unable to modify it to my needs. Can someone help me, please?




MWE



documentclassarticle

usepackage[latin1]inputenx
usepackagefilecontents
usepackage[
miktex, %
subfolder, % generated graphs in a ”gnuplottex” subfolder
cleanup, % Delete the .gnuplot files after conversion
]gnuplottex

newcommanddatapath./ZZZ

begindocument

% This is the data file to be plotted from
beginfilecontents*datapath/data.csv
Col1,Col2
0,0
1,1
endfilecontents*

% This is the gnuplot script I would like to use the value of datapath in
beginfilecontents*datapath/script.gnuplot
set key autotitle columnhead
set datafile separator "," # for csv-file
plot './ZZZ/data.csv' using 1:2 with lines
endfilecontents*

beginfigure[htbp]
centering
gnuplotloadfile[terminal=cairolatex]datapath/script.gnuplot
endfigure

enddocument









share|improve this question














I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position relative to the two documents. To re-use as much code as possible, I would like to define the relative path to the data in each document in a macro, here datapath.



My question is: How can I pass the value of this command to the gnuplot script? I would basically like to use the following in my MWE:



plot datapath'/data.csv' using 1:2 with lines


I did find this thread. However I was unable to modify it to my needs. Can someone help me, please?




MWE



documentclassarticle

usepackage[latin1]inputenx
usepackagefilecontents
usepackage[
miktex, %
subfolder, % generated graphs in a ”gnuplottex” subfolder
cleanup, % Delete the .gnuplot files after conversion
]gnuplottex

newcommanddatapath./ZZZ

begindocument

% This is the data file to be plotted from
beginfilecontents*datapath/data.csv
Col1,Col2
0,0
1,1
endfilecontents*

% This is the gnuplot script I would like to use the value of datapath in
beginfilecontents*datapath/script.gnuplot
set key autotitle columnhead
set datafile separator "," # for csv-file
plot './ZZZ/data.csv' using 1:2 with lines
endfilecontents*

beginfigure[htbp]
centering
gnuplotloadfile[terminal=cairolatex]datapath/script.gnuplot
endfigure

enddocument






macros expansion external-files gnuplottex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 15 '18 at 17:02









krtekkrtek

905820




905820





bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Your MWE works fine for me on Linux with pdflatex.

    – Lars Kotthoff
    Feb 15 '18 at 17:22











  • Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

    – krtek
    Feb 15 '18 at 17:30











  • See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

    – egreg
    Feb 15 '18 at 18:25


















  • Your MWE works fine for me on Linux with pdflatex.

    – Lars Kotthoff
    Feb 15 '18 at 17:22











  • Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

    – krtek
    Feb 15 '18 at 17:30











  • See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

    – egreg
    Feb 15 '18 at 18:25

















Your MWE works fine for me on Linux with pdflatex.

– Lars Kotthoff
Feb 15 '18 at 17:22





Your MWE works fine for me on Linux with pdflatex.

– Lars Kotthoff
Feb 15 '18 at 17:22













Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

– krtek
Feb 15 '18 at 17:30





Sure, it works great, no question. But I want to be able to use plot datapath'/data.csv' using 1:2 with lines instead of plot './ZZZ/data.csv' using 1:2 with lines. But how can I pass and expand the value of datapath inside the gnuplot document or store the content of datapath in a variable inside the gnuplot script as done in the post I linked to in my question?

– krtek
Feb 15 '18 at 17:30













See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

– egreg
Feb 15 '18 at 18:25






See stackoverflow.com/q/12328603/923955 I guess you need to do renewcommandgnuplotexegnuplot -e "dirname=./ZZZ" and use dirname in the script file. I don't know about quoting, though, perhaps you don't need them.

– egreg
Feb 15 '18 at 18:25











1 Answer
1






active

oldest

votes


















0














You can do it with immediatewrite instead of filecontents*:



newwritetempfile

immediateopenouttempfile=datapath/script.gnuplot
immediatewritetempfileset key autotitle columnhead;
set datafile separator ",";
plot 'datapath/data.csv' using 1:2 with lines
immediatecloseouttempfile





share|improve this answer























  • Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

    – krtek
    Feb 15 '18 at 17:56











  • I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

    – Lars Kotthoff
    Feb 15 '18 at 17:58











  • That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

    – krtek
    Feb 15 '18 at 18:02











  • This would require modifying the gnuplottex source code to read and replace a macro in the file.

    – Lars Kotthoff
    Feb 15 '18 at 18:11











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f415496%2fgnuplottex-pass-latex-command-to-gnuplot-script%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









0














You can do it with immediatewrite instead of filecontents*:



newwritetempfile

immediateopenouttempfile=datapath/script.gnuplot
immediatewritetempfileset key autotitle columnhead;
set datafile separator ",";
plot 'datapath/data.csv' using 1:2 with lines
immediatecloseouttempfile





share|improve this answer























  • Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

    – krtek
    Feb 15 '18 at 17:56











  • I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

    – Lars Kotthoff
    Feb 15 '18 at 17:58











  • That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

    – krtek
    Feb 15 '18 at 18:02











  • This would require modifying the gnuplottex source code to read and replace a macro in the file.

    – Lars Kotthoff
    Feb 15 '18 at 18:11















0














You can do it with immediatewrite instead of filecontents*:



newwritetempfile

immediateopenouttempfile=datapath/script.gnuplot
immediatewritetempfileset key autotitle columnhead;
set datafile separator ",";
plot 'datapath/data.csv' using 1:2 with lines
immediatecloseouttempfile





share|improve this answer























  • Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

    – krtek
    Feb 15 '18 at 17:56











  • I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

    – Lars Kotthoff
    Feb 15 '18 at 17:58











  • That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

    – krtek
    Feb 15 '18 at 18:02











  • This would require modifying the gnuplottex source code to read and replace a macro in the file.

    – Lars Kotthoff
    Feb 15 '18 at 18:11













0












0








0







You can do it with immediatewrite instead of filecontents*:



newwritetempfile

immediateopenouttempfile=datapath/script.gnuplot
immediatewritetempfileset key autotitle columnhead;
set datafile separator ",";
plot 'datapath/data.csv' using 1:2 with lines
immediatecloseouttempfile





share|improve this answer













You can do it with immediatewrite instead of filecontents*:



newwritetempfile

immediateopenouttempfile=datapath/script.gnuplot
immediatewritetempfileset key autotitle columnhead;
set datafile separator ",";
plot 'datapath/data.csv' using 1:2 with lines
immediatecloseouttempfile






share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 15 '18 at 17:52









Lars KotthoffLars Kotthoff

49836




49836












  • Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

    – krtek
    Feb 15 '18 at 17:56











  • I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

    – Lars Kotthoff
    Feb 15 '18 at 17:58











  • That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

    – krtek
    Feb 15 '18 at 18:02











  • This would require modifying the gnuplottex source code to read and replace a macro in the file.

    – Lars Kotthoff
    Feb 15 '18 at 18:11

















  • Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

    – krtek
    Feb 15 '18 at 17:56











  • I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

    – Lars Kotthoff
    Feb 15 '18 at 17:58











  • That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

    – krtek
    Feb 15 '18 at 18:02











  • This would require modifying the gnuplottex source code to read and replace a macro in the file.

    – Lars Kotthoff
    Feb 15 '18 at 18:11
















Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

– krtek
Feb 15 '18 at 17:56





Thanks, but the data files and the gnuplot script exist as files at a defined location. filecontents* was only used here to provide a complete MWE.

– krtek
Feb 15 '18 at 17:56













I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

– Lars Kotthoff
Feb 15 '18 at 17:58





I guess then I don't understand your question. How are you going to pass the location of the data if you don't write it to the script file?

– Lars Kotthoff
Feb 15 '18 at 17:58













That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

– krtek
Feb 15 '18 at 18:02





That exactly is my question. In this post the value of the line color is stored in a macro and expanded into a variable s inside the gnuplot script without writing it. So I guess it is possible. I just wasn't able to modify the approach to my problem. I always get the error that the files cannot be found.

– krtek
Feb 15 '18 at 18:02













This would require modifying the gnuplottex source code to read and replace a macro in the file.

– Lars Kotthoff
Feb 15 '18 at 18:11





This would require modifying the gnuplottex source code to read and replace a macro in the file.

– Lars Kotthoff
Feb 15 '18 at 18:11

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f415496%2fgnuplottex-pass-latex-command-to-gnuplot-script%23new-answer', 'question_page');

);

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







Popular posts from this blog

Isabella Eugénie Boyer Biographie | Références | Menu de navigationmodifiermodifier le codeComparator to Compute the Relative Value of a U.S. Dollar Amount – 1774 to Present.

Lioubotyn Sommaire Géographie | Histoire | Population | Notes et références | Liens externes | Menu de navigationlubotin.kharkov.uamodifier« Recensements et estimations de la population depuis 1897 »« Office des statistiques d'Ukraine : population au 1er janvier 2010, 2011 et 2012 »« Office des statistiques d'Ukraine : population au 1er janvier 2011, 2012 et 2013 »Informations officiellesCartes topographiquesCarte routièrem

Mpande kaSenzangakhona Biographie | Références | Menu de navigationmodifierMpande kaSenzangakhonavoir la liste des auteursm