What am trying to achieve is the following:
Of course, if this can be done so that there is a switch between even and odd pages. Currently I am only interested in the not appearing on the LHS margin. I currently do not have a MWE but I am throwing out the question. Probably you can start from here:
\documentclass[letterpaper]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{marginnote}
\usepackage{etoolbox}
\usepackage{calc}
\makeatletter
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\patchcmd{\@mn@margintest}{\@tempswafalse}{\@tempswatrue}{}{}
\reversemarginpar
\makeatother
\setlength{\marginparwidth}{2in}
\oddsidemargin 2in
\def\fbx#1{\vbox{\hbox{\hbox{#1}\setbox0\lastbox\copy0\kern\fboxsep\vrule width\fboxrule depth\dimexpr \fboxsep+\dp0\relax}%
\hrule height\fboxrule}}
\newcommand\caution[1]{%
\renewcommand*{\raggedleftmarginnote}{}
\relax\leavevmode\marginnote{%
{\sffamily\bfseries\textcolor{BrickRed}{Caution!}}\\[1pt]%
\fbx{\parbox[t]{\dimexpr\linewidth-3\marginparsep\relax}{#1}}%
}
}
\begin{document}
test \caution{some random text for testing caution frame}. some random text some random text some random text some random text some random text.
\end{document}
Best Answer
Here's one possibility using the
mdframed
package and\marginnote
from themarginnote
package:A zoomed image:
The optional argument for
\caution
allows you to control the vertical shifting if necessary.And here's another simpler option (which I personally like more) using
tikz
(andtikzpagenodes
):And a zoomed image:
An improved version; now there's an optional argument allowing you to change the position of the box and of the pointer; possible values are
b
,t
, andc
, to place the pointer at the bottom, at the top, and at the center, respectively, of the box:The
t
option is useful if the box will appear in the first lines of the text area;b
can be used in case the box will appear near the bottom of the text area.A little variation required in a comment; now \caution has three optional arguments and a mandatory one:
where ias an in the code immediately before, and can be
b
,t
, orc
(default=c
);<color>
controls the color used for the frame and title (default=BrickRed
);<title>
changes the title used for the frame (defualt=Caption!
);<text>
is the content of the note.