I was thinking that this is a small matter, but I can't seem to get my head around this.
I want to create a legend, which sits on the right side of the page.
I created a minipage
environment around the environment that I want to have on my right side and using \begin{flushright}
. However, I can't add a title inside this minipage environment so that it gets displayed on top of the surrounded environment.
The MWE is just an example. I don't use a table in my case. So how do align my title right above the other environment, in this case the table?
MWE:
\documentclass[paper=a4,landscape]{scrartcl}
\usepackage{longtable}
\begin{document}
\begin{minipage}[t]{0.95\textwidth}
Some Title.
\begin{flushright}
\begin{longtable}{ll}
Bla & Bla \\
Blubb & Blubb
\end{longtable}
\end{flushright}
\end{minipage}
\end{document}
Best Answer
I, in fact, would use a
tabular
environment for the title and the text; for the text, ap{<length>}
column (and@{}
to remove the extra space); inside thetabular
, the title can be centered using\multicolumn
:If this structure will be used several times, an environment can be defined; in the following example, the newly defined
myenv
environment has one mandatory argument (the title) and an optional argument (the width used to typeset the text with a default value of0.5\linewidth
):If the title spans more than one line, one could load the
array
package in the preamble:and then say