Make blocks of text invisible only if said so
Is there any command which allows me to make some blocks of text invisible only if initially I said so?
I.e., I would like to mark some lines throughout the text that would only appear in the compiled pdf if in the beggining of the document I said something like: "those blocks of text ON"; and I don't want them to appear if I said something like "those blocks of text OFF".
The purpose of this is to generate two different documents: one with more deitailed information and another one without those details.
Note that this is not the same as the phantom or comment commands.
text text-manipulation
add a comment |
Is there any command which allows me to make some blocks of text invisible only if initially I said so?
I.e., I would like to mark some lines throughout the text that would only appear in the compiled pdf if in the beggining of the document I said something like: "those blocks of text ON"; and I don't want them to appear if I said something like "those blocks of text OFF".
The purpose of this is to generate two different documents: one with more deitailed information and another one without those details.
Note that this is not the same as the phantom or comment commands.
text text-manipulation
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14
add a comment |
Is there any command which allows me to make some blocks of text invisible only if initially I said so?
I.e., I would like to mark some lines throughout the text that would only appear in the compiled pdf if in the beggining of the document I said something like: "those blocks of text ON"; and I don't want them to appear if I said something like "those blocks of text OFF".
The purpose of this is to generate two different documents: one with more deitailed information and another one without those details.
Note that this is not the same as the phantom or comment commands.
text text-manipulation
Is there any command which allows me to make some blocks of text invisible only if initially I said so?
I.e., I would like to mark some lines throughout the text that would only appear in the compiled pdf if in the beggining of the document I said something like: "those blocks of text ON"; and I don't want them to appear if I said something like "those blocks of text OFF".
The purpose of this is to generate two different documents: one with more deitailed information and another one without those details.
Note that this is not the same as the phantom or comment commands.
text text-manipulation
text text-manipulation
asked Dec 18 '18 at 15:36
AJHCAJHC
333
333
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14
add a comment |
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14
add a comment |
4 Answers
4
active
oldest
votes
The simplest way would be to do something like this in the preamble:
newcommand{additionalInfo}[1]{#1}
and then put all of those lines into that macro like this:
additionalInfo{I am additional}
If you don't want the lines to show up just replace above macro definition with
newcommand{additionalInfo}[1]{}
Not as elegant as the other answers but in my opinion the simplest solution...
documentclass{article}
% switch comment to disable additional info
newcommand{additionalInfo}[1]{#1}
% newcommand{additionalInfo}[1]{}
begin{document}
I am always here
additionalInfo{I am additional}
end{document}
add a comment |
One possibility is the multiaudience
package:
documentclass{article}
% remove comment from the following line for the long version
%defCurrentAudience{long}
usepackage{multiaudience}
SetNewAudience{long}
begin{document}
normal text
begin{shownto}{long}
Text for execs
end{shownto}
normal text
end{document}
add a comment |
You could use the ifthen
package to implement this:
documentclass{minimal}
usepackage{ifthen}
newboolean{somevariable}
setboolean{somevariable}{false}
begin{document}
ifthenelse{boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
end{document}
add a comment |
I usually do this using new if
s:
documentclass{article}
newififprintsolution
printsolutiontrue
begin{document}
Assignment.
ifprintsolution
Solution.
fi
end{document}
See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/
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%2f466380%2fmake-blocks-of-text-invisible-only-if-said-so%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
The simplest way would be to do something like this in the preamble:
newcommand{additionalInfo}[1]{#1}
and then put all of those lines into that macro like this:
additionalInfo{I am additional}
If you don't want the lines to show up just replace above macro definition with
newcommand{additionalInfo}[1]{}
Not as elegant as the other answers but in my opinion the simplest solution...
documentclass{article}
% switch comment to disable additional info
newcommand{additionalInfo}[1]{#1}
% newcommand{additionalInfo}[1]{}
begin{document}
I am always here
additionalInfo{I am additional}
end{document}
add a comment |
The simplest way would be to do something like this in the preamble:
newcommand{additionalInfo}[1]{#1}
and then put all of those lines into that macro like this:
additionalInfo{I am additional}
If you don't want the lines to show up just replace above macro definition with
newcommand{additionalInfo}[1]{}
Not as elegant as the other answers but in my opinion the simplest solution...
documentclass{article}
% switch comment to disable additional info
newcommand{additionalInfo}[1]{#1}
% newcommand{additionalInfo}[1]{}
begin{document}
I am always here
additionalInfo{I am additional}
end{document}
add a comment |
The simplest way would be to do something like this in the preamble:
newcommand{additionalInfo}[1]{#1}
and then put all of those lines into that macro like this:
additionalInfo{I am additional}
If you don't want the lines to show up just replace above macro definition with
newcommand{additionalInfo}[1]{}
Not as elegant as the other answers but in my opinion the simplest solution...
documentclass{article}
% switch comment to disable additional info
newcommand{additionalInfo}[1]{#1}
% newcommand{additionalInfo}[1]{}
begin{document}
I am always here
additionalInfo{I am additional}
end{document}
The simplest way would be to do something like this in the preamble:
newcommand{additionalInfo}[1]{#1}
and then put all of those lines into that macro like this:
additionalInfo{I am additional}
If you don't want the lines to show up just replace above macro definition with
newcommand{additionalInfo}[1]{}
Not as elegant as the other answers but in my opinion the simplest solution...
documentclass{article}
% switch comment to disable additional info
newcommand{additionalInfo}[1]{#1}
% newcommand{additionalInfo}[1]{}
begin{document}
I am always here
additionalInfo{I am additional}
end{document}
edited Dec 18 '18 at 16:21
answered Dec 18 '18 at 16:01
RavenRaven
1,077114
1,077114
add a comment |
add a comment |
One possibility is the multiaudience
package:
documentclass{article}
% remove comment from the following line for the long version
%defCurrentAudience{long}
usepackage{multiaudience}
SetNewAudience{long}
begin{document}
normal text
begin{shownto}{long}
Text for execs
end{shownto}
normal text
end{document}
add a comment |
One possibility is the multiaudience
package:
documentclass{article}
% remove comment from the following line for the long version
%defCurrentAudience{long}
usepackage{multiaudience}
SetNewAudience{long}
begin{document}
normal text
begin{shownto}{long}
Text for execs
end{shownto}
normal text
end{document}
add a comment |
One possibility is the multiaudience
package:
documentclass{article}
% remove comment from the following line for the long version
%defCurrentAudience{long}
usepackage{multiaudience}
SetNewAudience{long}
begin{document}
normal text
begin{shownto}{long}
Text for execs
end{shownto}
normal text
end{document}
One possibility is the multiaudience
package:
documentclass{article}
% remove comment from the following line for the long version
%defCurrentAudience{long}
usepackage{multiaudience}
SetNewAudience{long}
begin{document}
normal text
begin{shownto}{long}
Text for execs
end{shownto}
normal text
end{document}
answered Dec 18 '18 at 16:00
samcartersamcarter
91.8k7105297
91.8k7105297
add a comment |
add a comment |
You could use the ifthen
package to implement this:
documentclass{minimal}
usepackage{ifthen}
newboolean{somevariable}
setboolean{somevariable}{false}
begin{document}
ifthenelse{boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
end{document}
add a comment |
You could use the ifthen
package to implement this:
documentclass{minimal}
usepackage{ifthen}
newboolean{somevariable}
setboolean{somevariable}{false}
begin{document}
ifthenelse{boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
end{document}
add a comment |
You could use the ifthen
package to implement this:
documentclass{minimal}
usepackage{ifthen}
newboolean{somevariable}
setboolean{somevariable}{false}
begin{document}
ifthenelse{boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
end{document}
You could use the ifthen
package to implement this:
documentclass{minimal}
usepackage{ifthen}
newboolean{somevariable}
setboolean{somevariable}{false}
begin{document}
ifthenelse{boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
end{document}
answered Dec 18 '18 at 16:00
Uwe ZiegenhagenUwe Ziegenhagen
9,33743980
9,33743980
add a comment |
add a comment |
I usually do this using new if
s:
documentclass{article}
newififprintsolution
printsolutiontrue
begin{document}
Assignment.
ifprintsolution
Solution.
fi
end{document}
See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/
add a comment |
I usually do this using new if
s:
documentclass{article}
newififprintsolution
printsolutiontrue
begin{document}
Assignment.
ifprintsolution
Solution.
fi
end{document}
See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/
add a comment |
I usually do this using new if
s:
documentclass{article}
newififprintsolution
printsolutiontrue
begin{document}
Assignment.
ifprintsolution
Solution.
fi
end{document}
See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/
I usually do this using new if
s:
documentclass{article}
newififprintsolution
printsolutiontrue
begin{document}
Assignment.
ifprintsolution
Solution.
fi
end{document}
See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/
answered Dec 18 '18 at 16:11
BubayaBubaya
657310
657310
add a comment |
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%2f466380%2fmake-blocks-of-text-invisible-only-if-said-so%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
Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text?
– samcarter
Dec 18 '18 at 15:50
No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
– AJHC
Dec 18 '18 at 15:55
I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
– Rmano
Dec 18 '18 at 16:14