My question is simple: how can I force-move text to the left or right (or even outside of the margins)?
Some examples would be perfect.
My question is simple: how can I force-move text to the left or right (or even outside of the margins)?
Some examples would be perfect.
Does this code illustrate what you mean? I force a text to go in the margins (math and text). The \fbox are here only to show what's happening.
\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[showframe, lmargin = 3cm, rmargin = 4cm, nomarginpar, , noheadfoot]{geometry}
\usepackage{mathtools}
\parindent = 0pt
\begin{document}
Example : \medskip\\
\llap{\fbox{A text} }inserted in the left margin, \dotfill And now another text inserted\rlap{ \fbox{in the right margin.} }\\\\
$ \mathllap{a = b\ }$This formula went strolling in the left margin \hfill and this one the right one$ \mathrlap{\ u = v. } $\\\\
You also can superimpose two pieces ot text: \quad \clap{A}\clap{V}
\end{document}
Result:

\...lap, an \fbox shouldn't be necessary, since the lap is itself a box.
– barbara beeton
Mar 30 '14 at 00:42
Since I wrote the stackengine package, I will focus solely on ways that macros of that package can exceed the margins left and right. In addition, the stacking gap allows one to move text up and down with respect to the current location.
EDIT: In my drowsiness of the original post, I forgot all about the packages \stackinset macro.
\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\parskip .4in
\begin{document}
Normally stackinset is used to place things
\stackinset{c}{}{c}{}{$\bullet$}{inside} of a specified object.
However, there is nothing to prevent it from placing things
\stackinset{c}{.3in}{c}{.5in}{$\bullet$}{outside} of it.
When placed with respect to a null point, usage can be successive,
as in the void at the end of this sentence.\smash{%
\stackinset{c}{.3in}{c}{.3in}{NE}{}%
\stackinset{c}{-.3in}{c}{.3in}{NW}{}%
\stackinset{c}{-.3in}{c}{-.3in}{SW}{}%
\stackinset{c}{.3in}{c}{-.3in}{SE}{}%
}
But if placement is with respect to a finite sized anchor, usage must be nested:
\stackinset{c}{}{c}{.3in}{12}{%
\stackinset{c}{}{c}{-.3in}{6}{%
\stackinset{c}{-.3in}{c}{}{9}{%
\stackinset{c}{.3in}{c}{}{3}{%
\scalebox{19}{\rule{0ex}{1.17ex}$\circ$}%
}}}}
\end{document}

OTHER WAYS:
\documentclass{article}
\usepackage{stackengine}
\parskip 1em\parindent 0ex
\begin{document}
This is the margin:\par\vspace{-1.7em}
\noindent\hrulefill
{\sffamily\Large \toplap{l}{Stackengine}ways to exceed the margin:}
centering with hsmash can fit and center a larger object:
{\centering\hsmash{\rule{1.1\textwidth}{1ex}}\par}
without centering, hsmash is like a "clap", which can be used at
either margin
{\hsmash{\rule{1in}{1ex}}\hfill\hsmash{\rule{2in}{1ex}}\par}
while llap and rlap go left and right, toplap and bottomlap go
above and below left and right:
{\sffamily\toplap{l}{top left lap}normal text\hrulefill
normal text\bottomlap{r}{bottom right lap}}
\def\useanchorwidth{T}
useanchorwidth set "T" means the stacked material is only as
wide as the anchor at the base:
{\sffamily\noindent\stackon{anchor}{This is my stacked text}
\hfill but if the anchor is null and the stackgap is 0pt...
\hfill \stackon[0pt]{}{stacked text}}
Use of stackalignment can magnify the effect:
{\def\stackalignment{r}%
\sffamily\noindent\stackon{anchor}{This is my stacked text}
\hfill but if the anchor is null and the stackgap is 0pt...
\def\stackalignment{l}%
\hfill \stackon[0pt]{}{stacked text}}
This is the margin:\par\vspace{-2em}
\noindent\hrulefill
{\sffamily\setstackgap{L}{5.3in}
\smash{\toplap{l}{Last Code Line}}}By setting large stackgap, voila.
\end{document}

\hspace{-2em}or\hspace{2em}. Or\llap{<content>}or\rlap{<content>}. You can also use marginpar commands. – azetina Mar 29 '14 at 23:11\hspace*, otherwise it will disappear. and before an\llapat the beginning of a paragraph,\noindentis needed to get out of vertical mode;\leavevmodewill be sufficient if the paragraph isn't indented. – barbara beeton Mar 30 '14 at 00:48