# Build a box that starts after next line break

I have reason to insert notes in-text in boxes. I defined the following command for doing so:

\newcommand{\Lnote}[1]{%
\textsuperscript{\footnotesize{\thelnote}}
\begin{center}
\fbox{\parbox{0.7\textwidth}{\textsuperscript{\footnotesize{\thelnote}}#1}}
\end{center}
\stepcounter{lnote}
}


This does most of what I want: the notes are numbered by the lnote counter, etc. However, I would like it if the box containing the note didn't break the text, but rather occurred at the next line break. That is, if I wrote this:

Some really long thing that takes up more than one line.\Lnote{Something that should be noted.} You know, something that keeps on going on and on.


I would like it to not go:

Some really long thing that takes up more than one line.

Boxed in Something that should be noted.''

You know, something that keeps on going on and on.

But rather

Some really long thing that takes up more than one line. You know, something that keeps on

Boxed in Something that should be noted.''

going on and on.

(Note: I've ommitted the numbering in the examples of what I don't want and what do want. But I do want numbering, just like it is in the command as it already is. The important part is that I always want the boxed in note stuff to come at the next line break, not right where the note is noted, though I do want the lnote number to occur at the spot where the \Lnote command is invoked.)

• You can use \vadjust to insert material after the current line. – Ulrike Fischer Dec 29 '14 at 21:14

Use the \vadjust feature, plus some more low level constructions.

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\newcommand\Lnote[1]{%
\@bsphack
\nopagebreak
\smallskip
\moveright1cm\hbox{%
\fbox{\parbox{\dimexpr\textwidth-2cm}{#1}}%
}%
}%
\@esphack
}
\makeatother

\begin{document}

Some really long thing that takes up more than one line.
\Lnote{Boxed in Something that should be noted.'' \lipsum[3]}
You know, something that keeps on going on and on.

\end{document}


I use the \tabto* macro with the \TabPrevPos of the tabto package to get to the middle of the line and back again. In the midst of that, I use a bottom-center lap \bclap of stackengine package to make the box. In this way, the subsequent text may continue on the line prior to the box, using the normal flow of LaTeX linebreaking.

Here I implement it as \Lnote{}. EDITED to mimic the appearance laid out by the OP (superscript counter, \parbox of .7\textwidth)

\documentclass{article}
\usepackage{tabto,stackengine,lipsum}
\newcounter{lnote}
\newcommand\Lnote[1]{%
\stepcounter{lnote}%
\tabto*{.5\textwidth}%
\textsuperscript{\footnotesize{\thelnote}}%
\parbox[t]{0.7\textwidth}{#1}}}}%
\tabto*{\TabPrevPos}%
}
\begin{document}
Some really long thing that takes up more than one line.
\Lnote{Boxed in Something that should be noted.'' \lipsum[4]}
You know, something that keeps on going on and on.
\Lnote{Next one}
\lipsum[1]
\end{document}


You can do that very simply with the generic package ìnsbox, and more precisely with its \InsertBoxC command. Then everything is automatically centred, so you don't have to use a center environment in the definition of \Lnote:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

\input{insbox}
\newcounter{lnote}
\newcommand{\Lnote}[1]{
\stepcounter{lnote}\vspace*{-\fboxsep}
\fbox{\parbox{0.7\textwidth}{\textsuperscript{\footnotesize{\thelnote}}#1}}
}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius dapibus metus eget ultrices. Nulla sagittis mauris rutrum, blandit augue eget, laoreet augue. Phasellus enim odio, sagittis in mi sed, fringilla mollis odio. Phasellus quis purus ultricies, tempor purus at, tempus quam. Donec ultricies, ligula ac pretium porttitor, nibh nunc %
\InsertBoxC{\Lnote{Boxed in Something that should be noted.''}}%
Integer eros nibh, cursus at est sed, volutpat tristique justo. Donec ornare facilisis lorem, id feugiat elit pellentesque at. Nulla odio mauris, luctus sed faucibus id, dignissim dictum velit. Morbi vehicula velit at massa tristique rhoncus.

\end{document}