1

I'd like the following code:

\documentclass{article}

\usepackage{lipsum}

% macro definitions...

\begin{document}

\begin{signenv}{A} \lipsum[1] \end{signenv}

\end{document}

To produce this:

A top bottom frame with a sign

In words: the signenv environment's paragraph is flanked from the top and from the bottom by two lines the length of the paragraph. In the middle of the top line there's a diamond with a letter inside it. The letter is determined by the mandatory parameter passed to the signenv environment. There's some space between the diamond and the top line.

signenv must not embed the paragraph inside a TeX box/a tcolorbox etc.

Evan Aad
  • 11,066
  • Realgarding your last paragraph: what's the reason for not wanting to use tcolorbox? – leandriis Jul 16 '21 at 09:14
  • @leandriis: I've tried using tcolorboxs before, but found them to be very problematic when used in combination with programmable margin notes, a feature that I require. – Evan Aad Jul 16 '21 at 09:37

1 Answers1

3

enter image description here

\documentclass{article}

\usepackage{lipsum}

\newenvironment{signenv}[1]{% \par \smallskip \noindent\hrulefill\ % \begin{picture}(20,20)(0,0) \put(10,0){\makebox(0,0){#1}} \put(0,0){\line(1,1){10}} \put(0,0){\line(1,-1){10}} \put(20,0){\line(-1,1){10}} \put(20,0){\line(-1,-1){10}} \end{picture}\ % \hrulefill \par \bigskip} {\par\medskip\noindent\hrulefill\par\smallskip}

\begin{document}

\begin{signenv}{A} \lipsum[1] \end{signenv}

\end{document}

David Carlisle
  • 757,742
  • Thank you. This is great. Could you please create the lettered diamond in its own macro sign{A}/sign{B}/etc. so that I can use it inline in order to explain what each of the lettered diamonds mean? E.g. "The symbol \sign{C} means that the enclosed paragraph is a caveat, whereas the symbol \sign{A} means that it's an anecdote." – Evan Aad Jul 16 '21 at 09:42
  • @EvanAad you can do that, just cut the bit from begin picture to end picture and stick it in \newcommand\mydiamond[1]{..... – David Carlisle Jul 16 '21 at 09:44
  • But then the diamond drops below the line of text. – Evan Aad Jul 16 '21 at 09:50
  • @EvanAad well the rule is on the baseline and you wanted the angle of the diamond on there, you can change the (0,0) second argument to (0,10) or whatever in the self standing version. – David Carlisle Jul 16 '21 at 09:52
  • Thanks. One last request, please. The content I intend to surround with this environment is theorems. And when used with theorems the lines are too far from the theorem, as seen here. Could you please make the lines closer to the content? Also, if possible, the top line should never be in the bottom of a page, detached from the following content, nor should the bottom line ever be in the top of a page, detached from the preceding content. – Evan Aad Jul 16 '21 at 10:09
  • @EvanAad really you can adjust that yourself, I added \smallskip and \medskip in various places you could change them to \vspace{5cm} or whatever you need. Or change the spacing specified in your theorem declarations. – David Carlisle Jul 16 '21 at 10:11
  • 1
    I see. And keeping the lines on the same page as the content? Can this be arranged? – Evan Aad Jul 16 '21 at 10:15
  • 1
    @EvanAad add \nopagebreak before any skip – David Carlisle Jul 16 '21 at 10:22
  • It doesn't work. But I'll ask about it in a different post, so I can give a minimal example to demonstrate the issue. Thanks for all your help! – Evan Aad Jul 16 '21 at 10:34