Preprocess a .tex file and save it as a new file
I have several .tex
files that I would like to share with other people. I've included in them (with the command input
) several files with macros that I've written myself. However, I would like to send only a self-contained .tex
file.
What I need to do is generating another .tex
file where the input
command is replaced with the content of the file, pretty much like you would do by calling just the preprocessor in C.
I guess this could be done (relatively) easily with a bit of scripting, but I would like to know if there were a builtin option in a LaTeX compiler.
macros input include
add a comment |
I have several .tex
files that I would like to share with other people. I've included in them (with the command input
) several files with macros that I've written myself. However, I would like to send only a self-contained .tex
file.
What I need to do is generating another .tex
file where the input
command is replaced with the content of the file, pretty much like you would do by calling just the preprocessor in C.
I guess this could be done (relatively) easily with a bit of scripting, but I would like to know if there were a builtin option in a LaTeX compiler.
macros input include
2
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
1
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the stringinput
in verbatim or comments etc is trickier but usually not needed)
– David Carlisle
Mar 9 at 10:44
add a comment |
I have several .tex
files that I would like to share with other people. I've included in them (with the command input
) several files with macros that I've written myself. However, I would like to send only a self-contained .tex
file.
What I need to do is generating another .tex
file where the input
command is replaced with the content of the file, pretty much like you would do by calling just the preprocessor in C.
I guess this could be done (relatively) easily with a bit of scripting, but I would like to know if there were a builtin option in a LaTeX compiler.
macros input include
I have several .tex
files that I would like to share with other people. I've included in them (with the command input
) several files with macros that I've written myself. However, I would like to send only a self-contained .tex
file.
What I need to do is generating another .tex
file where the input
command is replaced with the content of the file, pretty much like you would do by calling just the preprocessor in C.
I guess this could be done (relatively) easily with a bit of scripting, but I would like to know if there were a builtin option in a LaTeX compiler.
macros input include
macros input include
edited Mar 9 at 10:40
JouleV
6,21121650
6,21121650
asked Mar 9 at 10:33
Mauro F.Mauro F.
1
1
2
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
1
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the stringinput
in verbatim or comments etc is trickier but usually not needed)
– David Carlisle
Mar 9 at 10:44
add a comment |
2
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
1
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the stringinput
in verbatim or comments etc is trickier but usually not needed)
– David Carlisle
Mar 9 at 10:44
2
2
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
1
1
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the string
input
in verbatim or comments etc is trickier but usually not needed)– David Carlisle
Mar 9 at 10:44
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the string
input
in verbatim or comments etc is trickier but usually not needed)– David Carlisle
Mar 9 at 10:44
add a comment |
0
active
oldest
votes
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%2f478562%2fpreprocess-a-tex-file-and-save-it-as-a-new-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f478562%2fpreprocess-a-tex-file-and-save-it-as-a-new-file%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
2
no (there are existing answers on site about this) latex never holds the source in memory or constructs the combined file.
– David Carlisle
Mar 9 at 10:40
@DavidCarlisle so you're saying that I have to do it by myself?
– Mauro F.
Mar 9 at 10:41
tex.stackexchange.com/questions/474203/… tex.stackexchange.com/questions/25713/… tex.stackexchange.com/questions/184152/… etc
– David Carlisle
Mar 9 at 10:42
1
I'm saying latex won't do it, but there are lots of tools that do (or claim to do) this for you. (it is trivial to write a few lines of perl to do this on any normal document, writing a general tool that gets it right on any document and copes with the string
input
in verbatim or comments etc is trickier but usually not needed)– David Carlisle
Mar 9 at 10:44