How can I execute a LaTeX command then hide the resulting text? [duplicate]












0
















This question already has an answer here:




  • Retain side-effects but discard command output

    3 answers



  • Hiding part of text leaving blank space

    6 answers




I would like to execute a command which produces text, but not have that text visible anywhere inside the document. Can we put the command inside a box, which clips other text, such as in the middle of the page? Normally, this would look ugly (a box text rendered on top of other text). Can we make the text invisible? That is, have a box smack dab in the middle of the page full of invisible text? Or what if we place the box of text outside of the page margins. That way, the text will be there, but not visible?










share|improve this question













marked as duplicate by Stefan Pinnow, samcarter, Circumscribe, Phelype Oleinik, Bobyandbob Jan 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • See also tex.stackexchange.com/questions/367513/…

    – John Kormylo
    Jan 11 at 3:35






  • 1





    Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

    – Werner
    Jan 11 at 3:56











  • Maybe tex.stackexchange.com/q/8981/35864 can help

    – moewe
    Jan 11 at 4:16











  • see also tex.stackexchange.com/q/243874/35864

    – moewe
    Jan 11 at 4:21











  • This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

    – Circumscribe
    Jan 11 at 12:52


















0
















This question already has an answer here:




  • Retain side-effects but discard command output

    3 answers



  • Hiding part of text leaving blank space

    6 answers




I would like to execute a command which produces text, but not have that text visible anywhere inside the document. Can we put the command inside a box, which clips other text, such as in the middle of the page? Normally, this would look ugly (a box text rendered on top of other text). Can we make the text invisible? That is, have a box smack dab in the middle of the page full of invisible text? Or what if we place the box of text outside of the page margins. That way, the text will be there, but not visible?










share|improve this question













marked as duplicate by Stefan Pinnow, samcarter, Circumscribe, Phelype Oleinik, Bobyandbob Jan 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • See also tex.stackexchange.com/questions/367513/…

    – John Kormylo
    Jan 11 at 3:35






  • 1





    Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

    – Werner
    Jan 11 at 3:56











  • Maybe tex.stackexchange.com/q/8981/35864 can help

    – moewe
    Jan 11 at 4:16











  • see also tex.stackexchange.com/q/243874/35864

    – moewe
    Jan 11 at 4:21











  • This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

    – Circumscribe
    Jan 11 at 12:52
















0












0








0









This question already has an answer here:




  • Retain side-effects but discard command output

    3 answers



  • Hiding part of text leaving blank space

    6 answers




I would like to execute a command which produces text, but not have that text visible anywhere inside the document. Can we put the command inside a box, which clips other text, such as in the middle of the page? Normally, this would look ugly (a box text rendered on top of other text). Can we make the text invisible? That is, have a box smack dab in the middle of the page full of invisible text? Or what if we place the box of text outside of the page margins. That way, the text will be there, but not visible?










share|improve this question















This question already has an answer here:




  • Retain side-effects but discard command output

    3 answers



  • Hiding part of text leaving blank space

    6 answers




I would like to execute a command which produces text, but not have that text visible anywhere inside the document. Can we put the command inside a box, which clips other text, such as in the middle of the page? Normally, this would look ugly (a box text rendered on top of other text). Can we make the text invisible? That is, have a box smack dab in the middle of the page full of invisible text? Or what if we place the box of text outside of the page margins. That way, the text will be there, but not visible?





This question already has an answer here:




  • Retain side-effects but discard command output

    3 answers



  • Hiding part of text leaving blank space

    6 answers








boxes






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 11 at 3:02









IdleCustardIdleCustard

1596




1596




marked as duplicate by Stefan Pinnow, samcarter, Circumscribe, Phelype Oleinik, Bobyandbob Jan 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Stefan Pinnow, samcarter, Circumscribe, Phelype Oleinik, Bobyandbob Jan 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • See also tex.stackexchange.com/questions/367513/…

    – John Kormylo
    Jan 11 at 3:35






  • 1





    Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

    – Werner
    Jan 11 at 3:56











  • Maybe tex.stackexchange.com/q/8981/35864 can help

    – moewe
    Jan 11 at 4:16











  • see also tex.stackexchange.com/q/243874/35864

    – moewe
    Jan 11 at 4:21











  • This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

    – Circumscribe
    Jan 11 at 12:52





















  • See also tex.stackexchange.com/questions/367513/…

    – John Kormylo
    Jan 11 at 3:35






  • 1





    Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

    – Werner
    Jan 11 at 3:56











  • Maybe tex.stackexchange.com/q/8981/35864 can help

    – moewe
    Jan 11 at 4:16











  • see also tex.stackexchange.com/q/243874/35864

    – moewe
    Jan 11 at 4:21











  • This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

    – Circumscribe
    Jan 11 at 12:52



















See also tex.stackexchange.com/questions/367513/…

– John Kormylo
Jan 11 at 3:35





See also tex.stackexchange.com/questions/367513/…

– John Kormylo
Jan 11 at 3:35




1




1





Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

– Werner
Jan 11 at 3:56





Are you specifically talking about writing this text as part of other text? That is, within some textual paragraph flow? Or do you just want to place the invisible text at an arbitrary position on the page? The latter seems odd, since you're placing something that can't be seen, so what's the point...?

– Werner
Jan 11 at 3:56













Maybe tex.stackexchange.com/q/8981/35864 can help

– moewe
Jan 11 at 4:16





Maybe tex.stackexchange.com/q/8981/35864 can help

– moewe
Jan 11 at 4:16













see also tex.stackexchange.com/q/243874/35864

– moewe
Jan 11 at 4:21





see also tex.stackexchange.com/q/243874/35864

– moewe
Jan 11 at 4:21













This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

– Circumscribe
Jan 11 at 12:52







This is a duplicate of Retain side-effects but discard command output, but not of Hiding part of text leaving blank space.

– Circumscribe
Jan 11 at 12:52












1 Answer
1






active

oldest

votes


















0














The following appears to work:



documentclass{minimal}
usepackage[pscoord]{eso-pic}
newcommand{placetextbox}[3]{
setbox0=hbox{#3}
AddToShipoutPictureFG*{
put(LenToUnit{#1paperwidth},LenToUnit{#2paperheight}){vtop{{null}makebox[0pt][c]{#3}}}%
}
}
begin{document}
This is Some Visible Text
placetextbox{0.5}{0.5}{phantom{INVISIBLE TEXT HERE}}
end{document}


You simply replace INVISIBLE TEXT HERE with the command you want executed, but do not want the output text from.



The solution above is based on Werner's answer to a different question. However, in that case, they were not trying to make the text invisible, or execute a command while discarding the resultant text.



For example, if you are using bibtex and you want something in your bibliography without having any in-text citations, then INVISIBLE TEXT HERE might be something like:



cite{Miller78} cite{Bubba94}





share|improve this answer





















  • 1





    placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

    – moewe
    Jan 11 at 4:09






  • 4





    The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

    – moewe
    Jan 11 at 4:10











  • @moewe Yes, nocite is a lot better than what I did. Thank you.

    – IdleCustard
    Jan 12 at 0:01











  • the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

    – David Carlisle
    Jan 13 at 12:26




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The following appears to work:



documentclass{minimal}
usepackage[pscoord]{eso-pic}
newcommand{placetextbox}[3]{
setbox0=hbox{#3}
AddToShipoutPictureFG*{
put(LenToUnit{#1paperwidth},LenToUnit{#2paperheight}){vtop{{null}makebox[0pt][c]{#3}}}%
}
}
begin{document}
This is Some Visible Text
placetextbox{0.5}{0.5}{phantom{INVISIBLE TEXT HERE}}
end{document}


You simply replace INVISIBLE TEXT HERE with the command you want executed, but do not want the output text from.



The solution above is based on Werner's answer to a different question. However, in that case, they were not trying to make the text invisible, or execute a command while discarding the resultant text.



For example, if you are using bibtex and you want something in your bibliography without having any in-text citations, then INVISIBLE TEXT HERE might be something like:



cite{Miller78} cite{Bubba94}





share|improve this answer





















  • 1





    placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

    – moewe
    Jan 11 at 4:09






  • 4





    The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

    – moewe
    Jan 11 at 4:10











  • @moewe Yes, nocite is a lot better than what I did. Thank you.

    – IdleCustard
    Jan 12 at 0:01











  • the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

    – David Carlisle
    Jan 13 at 12:26


















0














The following appears to work:



documentclass{minimal}
usepackage[pscoord]{eso-pic}
newcommand{placetextbox}[3]{
setbox0=hbox{#3}
AddToShipoutPictureFG*{
put(LenToUnit{#1paperwidth},LenToUnit{#2paperheight}){vtop{{null}makebox[0pt][c]{#3}}}%
}
}
begin{document}
This is Some Visible Text
placetextbox{0.5}{0.5}{phantom{INVISIBLE TEXT HERE}}
end{document}


You simply replace INVISIBLE TEXT HERE with the command you want executed, but do not want the output text from.



The solution above is based on Werner's answer to a different question. However, in that case, they were not trying to make the text invisible, or execute a command while discarding the resultant text.



For example, if you are using bibtex and you want something in your bibliography without having any in-text citations, then INVISIBLE TEXT HERE might be something like:



cite{Miller78} cite{Bubba94}





share|improve this answer





















  • 1





    placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

    – moewe
    Jan 11 at 4:09






  • 4





    The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

    – moewe
    Jan 11 at 4:10











  • @moewe Yes, nocite is a lot better than what I did. Thank you.

    – IdleCustard
    Jan 12 at 0:01











  • the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

    – David Carlisle
    Jan 13 at 12:26
















0












0








0







The following appears to work:



documentclass{minimal}
usepackage[pscoord]{eso-pic}
newcommand{placetextbox}[3]{
setbox0=hbox{#3}
AddToShipoutPictureFG*{
put(LenToUnit{#1paperwidth},LenToUnit{#2paperheight}){vtop{{null}makebox[0pt][c]{#3}}}%
}
}
begin{document}
This is Some Visible Text
placetextbox{0.5}{0.5}{phantom{INVISIBLE TEXT HERE}}
end{document}


You simply replace INVISIBLE TEXT HERE with the command you want executed, but do not want the output text from.



The solution above is based on Werner's answer to a different question. However, in that case, they were not trying to make the text invisible, or execute a command while discarding the resultant text.



For example, if you are using bibtex and you want something in your bibliography without having any in-text citations, then INVISIBLE TEXT HERE might be something like:



cite{Miller78} cite{Bubba94}





share|improve this answer















The following appears to work:



documentclass{minimal}
usepackage[pscoord]{eso-pic}
newcommand{placetextbox}[3]{
setbox0=hbox{#3}
AddToShipoutPictureFG*{
put(LenToUnit{#1paperwidth},LenToUnit{#2paperheight}){vtop{{null}makebox[0pt][c]{#3}}}%
}
}
begin{document}
This is Some Visible Text
placetextbox{0.5}{0.5}{phantom{INVISIBLE TEXT HERE}}
end{document}


You simply replace INVISIBLE TEXT HERE with the command you want executed, but do not want the output text from.



The solution above is based on Werner's answer to a different question. However, in that case, they were not trying to make the text invisible, or execute a command while discarding the resultant text.



For example, if you are using bibtex and you want something in your bibliography without having any in-text citations, then INVISIBLE TEXT HERE might be something like:



cite{Miller78} cite{Bubba94}






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 12 at 0:03

























answered Jan 11 at 3:32









IdleCustardIdleCustard

1596




1596








  • 1





    placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

    – moewe
    Jan 11 at 4:09






  • 4





    The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

    – moewe
    Jan 11 at 4:10











  • @moewe Yes, nocite is a lot better than what I did. Thank you.

    – IdleCustard
    Jan 12 at 0:01











  • the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

    – David Carlisle
    Jan 13 at 12:26
















  • 1





    placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

    – moewe
    Jan 11 at 4:09






  • 4





    The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

    – moewe
    Jan 11 at 4:10











  • @moewe Yes, nocite is a lot better than what I did. Thank you.

    – IdleCustard
    Jan 12 at 0:01











  • the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

    – David Carlisle
    Jan 13 at 12:26










1




1





placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

– moewe
Jan 11 at 4:09





placetextbox looks like it is based on tex.stackexchange.com/q/24663/35864. If that is the case the courteous thing to do is to acknowledge the earlier work that you build on.

– moewe
Jan 11 at 4:09




4




4





The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

– moewe
Jan 11 at 4:10





The standard way to get references in the bibliography without citing them explicitly in the text is nocite. nocite{sigfridsson,worman} will add the two entries sigfridsson and worman to the bibliography even if they have not been cited. nocite{*} adds all available entries to the bibliography. (See tex.stackexchange.com/q/17128/35864)

– moewe
Jan 11 at 4:10













@moewe Yes, nocite is a lot better than what I did. Thank you.

– IdleCustard
Jan 12 at 0:01





@moewe Yes, nocite is a lot better than what I did. Thank you.

– IdleCustard
Jan 12 at 0:01













the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

– David Carlisle
Jan 13 at 12:26







the question as asked would have been answered by simply sbox0=hbox{...} as that executes the commands in ... but (if you don't use the box) hides them. It would not answer your cite use case but that was not in the question. (and this is completely the wrong approach for that use case as moewe has pointed out) Also as you have used phantom this answer would work for cite but not for example anything using label.

– David Carlisle
Jan 13 at 12:26





Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?