3
$\begingroup$

Is there an easy way to add angled dividers in TextGrid or Grid.

Consider the following:

enter image description here

One fake way would be to use the following function.

angledDivider[text1_,text2_]:=Graphics[{
    {
        Directive[Thick,White],
        InfiniteLine[{{-1,1},{1,-1}}]
    },
    {
        Text[Style[text1,Directive[Bold,White,FontSize->11]],{-0.42,-0.4}],
        Text[Style[text2,Directive[Bold,White,FontSize->11]],{0.42,0.4}]
    }
},PlotRange->{{-1,1},{-1,1}},ImageSize->{70,70},Background->Gray,ImagePadding->None];

I can then add these graphics in positions in TextGrid using function:

TextGrid[{
    {angledDivider[...,...],...},
    ...
},
    Frame->All,
    FrameStyle->Directive[Thick,White],
    Background->{{},{},{...}},
    ItemStyle->{{{...},{},{...}},
    ItemSize->0,
    Alignment->{Center,Center},
    Spacings->{{3->0.25,4->0.15,5->0},{3->0.25,4->0.15,5->0}}
];

But the problem is it requires manual adjustment of text inside angledDivider. Is there a way to automatically wrap text inside these angledDivider.

Also once I put the angledDivider inside TextGrid it creates space between the boundary of the Graphics and the Frame of the TextGrid. This requires again manual control of Spacings.

Looking for a better way to add angled dividers in a TextGrid or Grid.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.