Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have never defined an entirely new environment in a LaTeX document - I have only ever modified existing environments to suit my purposes. Now, however, I suddenly have a use for an obscure environment, and have no idea where to start in creating it.

I am looking to define an environment in LaTeX where I can type text and equations in small connected boxes, so that the end result looks like a "tape", with each block containing equations and/or text and/or images. It also needs the following three additional properties:

  1. If the length of the sequence of blocks exceeds the width of the page (excluding margins), then the first block that would have exceeded that length is transferred to the next line, and the tape continues from there.

  2. The height of each block in a given line is equal to the height of the of the tallest block in that line, which is determined by wrapping around the tallest equation or text block with a small amount of padding.

  3. The final block has the option of not having a box drawn around it.

Here is a picture of the sort of thing I have in mind:

Tape environment demo

As I mentioned above, I am beyond my skills here. Does anyone know how to make such an environment? Anything ranging from general advice on how to figure this out to the completed code I need to make the environment would be very much appreciated.

Thanks very much.

share|improve this question
    
What do you expect your input to be like? –  Manuel Jun 12 at 18:50
    
Thanks for the reply. I'm not sure if this is what you mean, but for my input I will just be manually entering stuff - this won't be any kind of dynamic document, simply a pdf. Thanks. –  user3558855 Jun 18 at 23:30
    
I meant if you wanted it to be something like \cell{…}\cell{…}\cell{…} or \blockparagraph{…, …, …, …, …, …}. But you like David's answer :D Don't forget to click on the green tick to accept the answer as correct (and to upvote, if you want). That's the way here to say thank you for the answer. –  Manuel Jun 19 at 8:15
    
Will do, thanks for the advice! –  user3558855 Jun 20 at 17:28
add comment

1 Answer 1

up vote 12 down vote accepted

maybe this will get you started

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newenvironment{tape}{%
\par\bigskip
\setlength\parindent{0pt}%
\setlength\parfillskip{0pt}%
\offinterlineskip
\hrule\vskip-.4pt\relax\par}{%
\par\bigskip
}
\newcommand{\cell}[1]{%\hfill
\vrule
\vadjust{\hrule\vskip-.4pt}%
\mbox{ $\displaystyle#1$ }\vrule\hfill
\ignorespaces}

\begin{document}

\begin{tape}%
\cell{x+y}\cell{\sum_0^n(x+y)^2 = x^8}
\cell{a}\cell{\frac{1}{1+\frac{1}{1+1}}}
\cell{1+2+3=£=2+1}\cell{A=\begin{pmatrix}1&2\\3&4\end{pmatrix}}
\cell{1+2+3}\cell{\sqrt{\frac{a}{b}}}
\cell{\sum_C(x+y)^2 = x^8}
\cell{a^{a^{a^a}}}\cell{1+2+3=£=2+1}
\cell{\frac{1}{1+\frac{1}{1+1}}}
\cell{1}\cell{2}\cell{4}
\cell{1}\cell{2}\cell{4}
\end{tape}

\begin{tape}
\cell{1}\cell{2}\cell{4}
\cell{1}\cell{2}\cell{4}
\cell{\sum_C(x+y)^2 = x^8}
\cell{a^{a^{a^a}}}\cell{1+2+3=£=2+1}
\cell{a}\cell{\frac{1}{1+\frac{1}{1+1}}}
\cell{x+y}\cell{\sum_0^n(x+y)^2 = x^8}
\cell{1+2+3=£=2+1}\cell{A=\begin{pmatrix}1&2\\3&4\end{pmatrix}}
\cell{1+2+3}\cell{\sqrt{\frac{a}{b}}}
\cell{\frac{1}{1+\frac{1}{1+1}}}
\end{tape}

\end{document}
share|improve this answer
    
Thanks very much! This will be great to get me started, from here I think I will be able to mess around with it until it works. Thanks again. –  user3558855 Jun 18 at 23:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.