Perfect.
Good to see \fbox and \rule are used 😉

R.E. Boss


-----Original Message-----
From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 
'Viktor Grigorov' via Programming
Sent: zaterdag 16 juli 2022 18:28
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] LaTeX question: J-boxed display

Thanks. I should have responded earlier with the solution we went with provided 
from a tex stackexchange bloke:

\usepackage{listofitems}
\newlength\maxht
\newlength\maxdp
\newcommand\cbox[1]{%
  \readlist*\mylist{#1}%
  \maxht=0pt%
  \maxdp=0pt%
  \foreachitem\z\in\mylist[]{%
    \setbox0=\hbox{\z}%
    \ifdim\ht0>\maxht\relax\maxht=\ht0\fi%
    \ifdim\dp0>\maxdp\relax\maxdp=\dp0\fi%
  }%
  \foreachitem\z\in\mylist[]{%
    \fbox{\z\rule[-\maxdp]{0pt}{\dimexpr\maxdp+\maxht}}%
    \kern-\fboxrule%
  }%
}

To get a 5--6-tuply nested 0 next to an empty box at each level one would need 
only write:\cbox{,\cbox{,\cbox{,\cbox{,\cbox{,\cbox{,0}}}}}} elements of a box 
at any level are the comma-separated items.



Jul 16, 2022, 18:27 by r.e.b...@outlook.com:

> See also https://www.overleaf.com/read/kbqvskbjdcrc
>
>
> R.E. Boss
>
>
> -----Original Message-----
> From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 
> R.E. Boss
> Sent: zaterdag 16 juli 2022 17:14
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] LaTeX question: J-boxed display
>
> I know a thing are two about Latex (and tikz).
>
>  < 2;<1 2 
> \fbox{\fbox{2}\fbox{1 2}} 
>
>  2 ; <<1 2
> \fbox{2\rule[-1.2mm]{0cm}{5.1mm}}\fbox{\fbox{1 2}}
>
>  a:,<1 2
> \fbox{ \rule{0cm}{2.7mm}}\fbox{1 2}
>
> You probably must fiddle a bit with the sizes.
> You can enter the latex expressions in https://latex.codecogs.com/ (or any 
> online latex editor) to judge the output.
> Otherwise, see here 
> https://drive.google.com/file/d/1cDp-ByCXJniQZ_Tm8zq0l7uvZdS2d__X/view?usp=sharing
>  
> Hope this helps.
>
>
> R.E. Boss
>
>
> -----Original Message-----
> From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 
> Henry Rich
> Sent: woensdag 13 juli 2022 20:28
> To: J-programming forum <programm...@jsoftware.com>
> Subject: [Jprogramming] LaTeX question: J-boxed display
>
> Viktor Grigorov is working on a new J Reference card, with a little advice 
> from me.  He is using LaTeX. We would like to create displays of boxed nouns 
> that look like what J produces:
>
>     < 2;<1 2
> +-------+
> |+-+---+|
> ||2|1 2||
> |+-+---+|
> +-------+
>     2 ; <<1 2  NB. display fudged to center the first box vertically
> +-+-----+
> | |+---+|
> |2||1 2||
> | |+---+|
> +-+-----+
>     a:,<1 2
> ++---+
> ||1 2|
> ++---+
>
> The display should use solid lines for the borders, not + - and |.
>
> We are having trouble lining up the boxes just right.  Can someone post LaTeX 
> snippets to format those properly?
>
> Henry Rich
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to