Make blocks of text invisible only if said so












6















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.










share|improve this question























  • 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
















6















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.










share|improve this question























  • 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














6












6








6


3






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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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










4 Answers
4






active

oldest

votes


















3














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}





share|improve this answer

































    7














    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}





    share|improve this answer































      5














      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}





      share|improve this answer































        4














        I usually do this using new ifs:



        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/






        share|improve this answer























          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%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









          3














          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}





          share|improve this answer






























            3














            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}





            share|improve this answer




























              3












              3








              3







              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}





              share|improve this answer















              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}






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 18 '18 at 16:21

























              answered Dec 18 '18 at 16:01









              RavenRaven

              967112




              967112























                  7














                  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}





                  share|improve this answer




























                    7














                    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}





                    share|improve this answer


























                      7












                      7








                      7







                      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}





                      share|improve this answer













                      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}






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Dec 18 '18 at 16:00









                      samcartersamcarter

                      86.7k795279




                      86.7k795279























                          5














                          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}





                          share|improve this answer




























                            5














                            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}





                            share|improve this answer


























                              5












                              5








                              5







                              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}





                              share|improve this answer













                              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}






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 18 '18 at 16:00









                              Uwe ZiegenhagenUwe Ziegenhagen

                              9,29243980




                              9,29243980























                                  4














                                  I usually do this using new ifs:



                                  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/






                                  share|improve this answer




























                                    4














                                    I usually do this using new ifs:



                                    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/






                                    share|improve this answer


























                                      4












                                      4








                                      4







                                      I usually do this using new ifs:



                                      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/






                                      share|improve this answer













                                      I usually do this using new ifs:



                                      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/







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Dec 18 '18 at 16:11









                                      BubayaBubaya

                                      38619




                                      38619






























                                          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%2f466380%2fmake-blocks-of-text-invisible-only-if-said-so%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

                                          Plaza Victoria

                                          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                                          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...