TikZ rectangle split horizontal extra space

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












The following code gives extra space both on the left under the graphic and on the right under the text. Is there a way to make the split rectangles tight against the larger text or graphic?



% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX

documentclassarticle

usepackagegraphicx
usepackagetikz
usepackagemulticol

usetikzlibraryshapes.multipart,positioning

newsaveboxtestbox

begindocument

beginlrboxtestbox
beginminipage3in
beginmulticols2
This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
endmulticols
And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
endminipage
endlrbox

tikz%
node[%
rectangle split,
rectangle split parts=2,
rectangle split horizontal,
rectangle split part align=top,
draw,
line width=3pt
](test)%
includegraphics[width=2in]example-image-a
nodeparttwo useboxtestbox.
;
node[above=12pt of test.south,fill=white]%
bfseriesLARGEcolorred $Longleftarrow$ EXTRA SPACE? $Longrightarrow$;
%

enddocument


Example of extra space.










share|improve this question

























    up vote
    3
    down vote

    favorite












    The following code gives extra space both on the left under the graphic and on the right under the text. Is there a way to make the split rectangles tight against the larger text or graphic?



    % !TEX encoding = UTF-8 Unicode
    % !TEX TS-program = XeLaTeX

    documentclassarticle

    usepackagegraphicx
    usepackagetikz
    usepackagemulticol

    usetikzlibraryshapes.multipart,positioning

    newsaveboxtestbox

    begindocument

    beginlrboxtestbox
    beginminipage3in
    beginmulticols2
    This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
    endmulticols
    And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
    endminipage
    endlrbox

    tikz%
    node[%
    rectangle split,
    rectangle split parts=2,
    rectangle split horizontal,
    rectangle split part align=top,
    draw,
    line width=3pt
    ](test)%
    includegraphics[width=2in]example-image-a
    nodeparttwo useboxtestbox.
    ;
    node[above=12pt of test.south,fill=white]%
    bfseriesLARGEcolorred $Longleftarrow$ EXTRA SPACE? $Longrightarrow$;
    %

    enddocument


    Example of extra space.










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      The following code gives extra space both on the left under the graphic and on the right under the text. Is there a way to make the split rectangles tight against the larger text or graphic?



      % !TEX encoding = UTF-8 Unicode
      % !TEX TS-program = XeLaTeX

      documentclassarticle

      usepackagegraphicx
      usepackagetikz
      usepackagemulticol

      usetikzlibraryshapes.multipart,positioning

      newsaveboxtestbox

      begindocument

      beginlrboxtestbox
      beginminipage3in
      beginmulticols2
      This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
      endmulticols
      And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
      endminipage
      endlrbox

      tikz%
      node[%
      rectangle split,
      rectangle split parts=2,
      rectangle split horizontal,
      rectangle split part align=top,
      draw,
      line width=3pt
      ](test)%
      includegraphics[width=2in]example-image-a
      nodeparttwo useboxtestbox.
      ;
      node[above=12pt of test.south,fill=white]%
      bfseriesLARGEcolorred $Longleftarrow$ EXTRA SPACE? $Longrightarrow$;
      %

      enddocument


      Example of extra space.










      share|improve this question













      The following code gives extra space both on the left under the graphic and on the right under the text. Is there a way to make the split rectangles tight against the larger text or graphic?



      % !TEX encoding = UTF-8 Unicode
      % !TEX TS-program = XeLaTeX

      documentclassarticle

      usepackagegraphicx
      usepackagetikz
      usepackagemulticol

      usetikzlibraryshapes.multipart,positioning

      newsaveboxtestbox

      begindocument

      beginlrboxtestbox
      beginminipage3in
      beginmulticols2
      This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
      endmulticols
      And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
      endminipage
      endlrbox

      tikz%
      node[%
      rectangle split,
      rectangle split parts=2,
      rectangle split horizontal,
      rectangle split part align=top,
      draw,
      line width=3pt
      ](test)%
      includegraphics[width=2in]example-image-a
      nodeparttwo useboxtestbox.
      ;
      node[above=12pt of test.south,fill=white]%
      bfseriesLARGEcolorred $Longleftarrow$ EXTRA SPACE? $Longrightarrow$;
      %

      enddocument


      Example of extra space.







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      sgmoye

      3,61011125




      3,61011125




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          This has to do with the way you include the graphics. Here is one out of many ways to fix it: put it in some box. My choice is not special/important.



          documentclassarticle

          usepackagegraphicx
          usepackagetikz
          usepackagemulticol

          usetikzlibraryshapes.multipart,positioning

          newsaveboxtestbox

          begindocument

          beginlrboxtestbox
          beginminipage3in
          beginmulticols2
          This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
          endmulticols
          And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
          endminipage
          endlrbox

          tikz%
          node[%
          rectangle split,
          rectangle split parts=2,
          rectangle split horizontal,
          rectangle split part align=top,
          draw,
          line width=3pt
          ](test)%
          $vcenterhboxincludegraphics[width=2in]example-image-a$
          nodeparttwo useboxtestbox.
          ;
          %

          enddocument


          enter image description here






          share|improve this answer




















          • Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
            – sgmoye
            1 hour ago







          • 1




            @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
            – marmot
            16 mins ago


















          up vote
          2
          down vote













          an alternative solution is use of the adjustbox package:



          documentclassarticle
          usepackage[export]adjustbox
          usepackagetikz
          usetikzlibrarypositioning,
          shapes.multipart
          usepackagemulticol
          usepackageragged2e

          newsaveboxtestbox

          begindocument

          beginlrboxtestbox
          beginminipage3inRaggedRight
          beginmulticols2
          This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
          endmulticols
          And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
          endminipage
          endlrbox

          tikz%
          node[%
          rectangle split,
          rectangle split parts=2,
          rectangle split horizontal,
          rectangle split part align=top,
          draw,
          line width=3pt
          ] (test)
          includegraphics[width=2in,valign=c]example-image-a % with "valign=c" is image baseline moved to its vertical center
          nodeparttwo useboxtestbox
          ;


          enddocument


          enter image description here






          share|improve this answer




















          • Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
            – sgmoye
            44 mins ago










          • all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
            – Zarko
            34 mins ago


















          up vote
          2
          down vote













          In case you could accept text box and not a TikZ node, tcolorbox offers a tcbsidebyside box where you can decide which part will adapt to its size while the other uses the available space (textwidth or box width).



          documentclassarticle
          usepackage[most]tcolorbox
          usepackagemulticol
          usepackagelmodern

          begindocument
          tcbsidebyside[notitle,
          sidebyside adapt=left,
          colback=white,
          enhanced,
          segmentation style=solid,
          sharp corners]
          %
          includegraphics[width=3cm]example-image-a
          %
          beginmulticols2
          This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
          endmulticols
          And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more


          tcbsidebyside[notitle,
          sidebyside adapt=left,
          colback=white,
          enhanced,
          segmentation style=solid,
          sharp corners]
          %
          includegraphics[width=5cm]example-image-a
          %
          And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more

          enddocument


          enter image description here






          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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f452488%2ftikz-rectangle-split-horizontal-extra-space%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            This has to do with the way you include the graphics. Here is one out of many ways to fix it: put it in some box. My choice is not special/important.



            documentclassarticle

            usepackagegraphicx
            usepackagetikz
            usepackagemulticol

            usetikzlibraryshapes.multipart,positioning

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3in
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ](test)%
            $vcenterhboxincludegraphics[width=2in]example-image-a$
            nodeparttwo useboxtestbox.
            ;
            %

            enddocument


            enter image description here






            share|improve this answer




















            • Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
              – sgmoye
              1 hour ago







            • 1




              @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
              – marmot
              16 mins ago















            up vote
            1
            down vote



            accepted










            This has to do with the way you include the graphics. Here is one out of many ways to fix it: put it in some box. My choice is not special/important.



            documentclassarticle

            usepackagegraphicx
            usepackagetikz
            usepackagemulticol

            usetikzlibraryshapes.multipart,positioning

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3in
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ](test)%
            $vcenterhboxincludegraphics[width=2in]example-image-a$
            nodeparttwo useboxtestbox.
            ;
            %

            enddocument


            enter image description here






            share|improve this answer




















            • Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
              – sgmoye
              1 hour ago







            • 1




              @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
              – marmot
              16 mins ago













            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            This has to do with the way you include the graphics. Here is one out of many ways to fix it: put it in some box. My choice is not special/important.



            documentclassarticle

            usepackagegraphicx
            usepackagetikz
            usepackagemulticol

            usetikzlibraryshapes.multipart,positioning

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3in
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ](test)%
            $vcenterhboxincludegraphics[width=2in]example-image-a$
            nodeparttwo useboxtestbox.
            ;
            %

            enddocument


            enter image description here






            share|improve this answer












            This has to do with the way you include the graphics. Here is one out of many ways to fix it: put it in some box. My choice is not special/important.



            documentclassarticle

            usepackagegraphicx
            usepackagetikz
            usepackagemulticol

            usetikzlibraryshapes.multipart,positioning

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3in
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ](test)%
            $vcenterhboxincludegraphics[width=2in]example-image-a$
            nodeparttwo useboxtestbox.
            ;
            %

            enddocument


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 hours ago









            marmot

            60.2k464131




            60.2k464131











            • Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
              – sgmoye
              1 hour ago







            • 1




              @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
              – marmot
              16 mins ago

















            • Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
              – sgmoye
              1 hour ago







            • 1




              @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
              – marmot
              16 mins ago
















            Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
            – sgmoye
            1 hour ago





            Hmmm. Thanks, but this begs the question: Why are two levels of extra boxing necessary to make this happen? I tried hbox and mbox but would wouldn't have thought of vcenter in a gajillion years. Some interaction between includegraphics and rectangle split horizontal? I don't think I've ever seen includegraphics behave this way on its own. Thanks for the help!
            – sgmoye
            1 hour ago





            1




            1




            @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
            – marmot
            16 mins ago





            @sgmoye Sorry, I am in meeting after meeting. vcenter was what I immediately thought of using here, just compare $xincludegraphics[width=2in]example-image-a$ to $xvcenterhboxincludegraphics[width=2in]example-image-a$. The latter is the standard trick of vertically centering things in an equation. So my thought was to try it and it worked. Need to rush to the next meeting, will explain more later.
            – marmot
            16 mins ago











            up vote
            2
            down vote













            an alternative solution is use of the adjustbox package:



            documentclassarticle
            usepackage[export]adjustbox
            usepackagetikz
            usetikzlibrarypositioning,
            shapes.multipart
            usepackagemulticol
            usepackageragged2e

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3inRaggedRight
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ] (test)
            includegraphics[width=2in,valign=c]example-image-a % with "valign=c" is image baseline moved to its vertical center
            nodeparttwo useboxtestbox
            ;


            enddocument


            enter image description here






            share|improve this answer




















            • Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
              – sgmoye
              44 mins ago










            • all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
              – Zarko
              34 mins ago















            up vote
            2
            down vote













            an alternative solution is use of the adjustbox package:



            documentclassarticle
            usepackage[export]adjustbox
            usepackagetikz
            usetikzlibrarypositioning,
            shapes.multipart
            usepackagemulticol
            usepackageragged2e

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3inRaggedRight
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ] (test)
            includegraphics[width=2in,valign=c]example-image-a % with "valign=c" is image baseline moved to its vertical center
            nodeparttwo useboxtestbox
            ;


            enddocument


            enter image description here






            share|improve this answer




















            • Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
              – sgmoye
              44 mins ago










            • all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
              – Zarko
              34 mins ago













            up vote
            2
            down vote










            up vote
            2
            down vote









            an alternative solution is use of the adjustbox package:



            documentclassarticle
            usepackage[export]adjustbox
            usepackagetikz
            usetikzlibrarypositioning,
            shapes.multipart
            usepackagemulticol
            usepackageragged2e

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3inRaggedRight
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ] (test)
            includegraphics[width=2in,valign=c]example-image-a % with "valign=c" is image baseline moved to its vertical center
            nodeparttwo useboxtestbox
            ;


            enddocument


            enter image description here






            share|improve this answer












            an alternative solution is use of the adjustbox package:



            documentclassarticle
            usepackage[export]adjustbox
            usepackagetikz
            usetikzlibrarypositioning,
            shapes.multipart
            usepackagemulticol
            usepackageragged2e

            newsaveboxtestbox

            begindocument

            beginlrboxtestbox
            beginminipage3inRaggedRight
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more
            endminipage
            endlrbox

            tikz%
            node[%
            rectangle split,
            rectangle split parts=2,
            rectangle split horizontal,
            rectangle split part align=top,
            draw,
            line width=3pt
            ] (test)
            includegraphics[width=2in,valign=c]example-image-a % with "valign=c" is image baseline moved to its vertical center
            nodeparttwo useboxtestbox
            ;


            enddocument


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 52 mins ago









            Zarko

            113k861150




            113k861150











            • Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
              – sgmoye
              44 mins ago










            • all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
              – Zarko
              34 mins ago

















            • Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
              – sgmoye
              44 mins ago










            • all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
              – Zarko
              34 mins ago
















            Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
            – sgmoye
            44 mins ago




            Thank you -- that also didn't occur to me at all. But why is all this necessary? What is the underlying mechanism that causes the extra space? I'd like to be aware of the mechanics so that I can avoid a similar conundrum in the future. Thanks again. I've learned something and that's always nice...
            – sgmoye
            44 mins ago












            all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
            – Zarko
            34 mins ago





            all is about boxes. and how they are aligned to each other. but i might be wrong. you should read TeXbook ... (instead thanks, you can up-vote both answers)
            – Zarko
            34 mins ago











            up vote
            2
            down vote













            In case you could accept text box and not a TikZ node, tcolorbox offers a tcbsidebyside box where you can decide which part will adapt to its size while the other uses the available space (textwidth or box width).



            documentclassarticle
            usepackage[most]tcolorbox
            usepackagemulticol
            usepackagelmodern

            begindocument
            tcbsidebyside[notitle,
            sidebyside adapt=left,
            colback=white,
            enhanced,
            segmentation style=solid,
            sharp corners]
            %
            includegraphics[width=3cm]example-image-a
            %
            beginmulticols2
            This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
            endmulticols
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more


            tcbsidebyside[notitle,
            sidebyside adapt=left,
            colback=white,
            enhanced,
            segmentation style=solid,
            sharp corners]
            %
            includegraphics[width=5cm]example-image-a
            %
            And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more

            enddocument


            enter image description here






            share|improve this answer
























              up vote
              2
              down vote













              In case you could accept text box and not a TikZ node, tcolorbox offers a tcbsidebyside box where you can decide which part will adapt to its size while the other uses the available space (textwidth or box width).



              documentclassarticle
              usepackage[most]tcolorbox
              usepackagemulticol
              usepackagelmodern

              begindocument
              tcbsidebyside[notitle,
              sidebyside adapt=left,
              colback=white,
              enhanced,
              segmentation style=solid,
              sharp corners]
              %
              includegraphics[width=3cm]example-image-a
              %
              beginmulticols2
              This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
              endmulticols
              And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more


              tcbsidebyside[notitle,
              sidebyside adapt=left,
              colback=white,
              enhanced,
              segmentation style=solid,
              sharp corners]
              %
              includegraphics[width=5cm]example-image-a
              %
              And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more

              enddocument


              enter image description here






              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                In case you could accept text box and not a TikZ node, tcolorbox offers a tcbsidebyside box where you can decide which part will adapt to its size while the other uses the available space (textwidth or box width).



                documentclassarticle
                usepackage[most]tcolorbox
                usepackagemulticol
                usepackagelmodern

                begindocument
                tcbsidebyside[notitle,
                sidebyside adapt=left,
                colback=white,
                enhanced,
                segmentation style=solid,
                sharp corners]
                %
                includegraphics[width=3cm]example-image-a
                %
                beginmulticols2
                This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
                endmulticols
                And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more


                tcbsidebyside[notitle,
                sidebyside adapt=left,
                colback=white,
                enhanced,
                segmentation style=solid,
                sharp corners]
                %
                includegraphics[width=5cm]example-image-a
                %
                And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more

                enddocument


                enter image description here






                share|improve this answer












                In case you could accept text box and not a TikZ node, tcolorbox offers a tcbsidebyside box where you can decide which part will adapt to its size while the other uses the available space (textwidth or box width).



                documentclassarticle
                usepackage[most]tcolorbox
                usepackagemulticol
                usepackagelmodern

                begindocument
                tcbsidebyside[notitle,
                sidebyside adapt=left,
                colback=white,
                enhanced,
                segmentation style=solid,
                sharp corners]
                %
                includegraphics[width=3cm]example-image-a
                %
                beginmulticols2
                This is a lot of bla bla bla to see what is happening. And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more.
                endmulticols
                And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more


                tcbsidebyside[notitle,
                sidebyside adapt=left,
                colback=white,
                enhanced,
                segmentation style=solid,
                sharp corners]
                %
                includegraphics[width=5cm]example-image-a
                %
                And this is more text. and a lot more. And this is more text. and a lot more. And this is more text. and a lot more

                enddocument


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 17 mins ago









                Ignasi

                87.3k4157292




                87.3k4157292



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452488%2ftikz-rectangle-split-horizontal-extra-space%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                    Confectionery