I am new to LaTex, so please bare with me. :-)
1) I want to place 2 frameboxes next to one another using this code:
\framebox[5cm][l]{Text 1}
\framebox[5cm][l]{Text 2}
I want the two boxes to be directly next to one another, without the
vertical space between them. Is this possible?
2) I want to create a box (using \makebox) that consists out of 3
lines, and must be stretched from left to right. I use the following
code, which works for one line.
\makebox[7cm][s]{\textsf{\tiny\textbf{This is line 1}}}
How can I add the other two lines to the same box?
Thank you!
> Hello everyone,
>
> I am new to LaTex, so please bare with me. :-)
>
> 1) I want to place 2 frameboxes next to one another using this code:
>
> \framebox[5cm][l]{Text 1}
> \framebox[5cm][l]{Text 2}
>
> I want the two boxes to be directly next to one another, without the
> vertical space between them. Is this possible?
vertical? Don't you mean horizontal? The space between the boxes is the
space after the brace. Remove it with %:
\framebox[5cm][l]{Text 1}%
\framebox[5cm][l]{Text 2}
>
> 2) I want to create a box (using \makebox) that consists out of 3
> lines, and must be stretched from left to right. I use the following
> code, which works for one line.
>
> \makebox[7cm][s]{\textsf{\tiny\textbf{This is line 1}}}
>
> How can I add the other two lines to the same box?
By putting them first in another box, e.g. a \parbox or a tabular.
--
Ulrike Fischer
On Oct 6, 12:33 pm, Ulrike Fischer <ne...@nililand.de> wrote:
> vertical? Don't you mean horizontal? The space between the boxes is the
> space after the brace. Remove it with %:
>
> \framebox[5cm][l]{Text 1}%
> \framebox[5cm][l]{Text 2}
>
Yes, thank you, that was exactly what I was looking for.
> By putting them first in another box, e.g. a \parbox or a tabular.
I tried something like this:
\framebox[8.4cm]{
\parbox[h][0.8cm][s]{8cm}{\tiny
THIS IS LINE 1 THIS IS LINE 1 THIS IS LINE 1\\
THIS IS LINE 2 THIS IS LINE 2 THIS IS LINE 2 THIS\\
THIS IS LINE 3 THIS IS LINE 3 THIS IS LINE 3 THI}}
but now the stretching is not working. What am I doing wrong?
Thank you
>> By putting them first in another box, e.g. a \parbox or a tabular.
>
> I tried something like this:
>
> \framebox[8.4cm]{
> \parbox[h][0.8cm][s]{8cm}{\tiny
> THIS IS LINE 1 THIS IS LINE 1 THIS IS LINE 1\\
> THIS IS LINE 2 THIS IS LINE 2 THIS IS LINE 2 THIS\\
> THIS IS LINE 3 THIS IS LINE 3 THIS IS LINE 3 THI}}
>
> but now the stretching is not working. What am I doing wrong?
The [s] is for vertical stretching. If you want horizontal stretching
put each line in a \makebox or do something like this:
\framebox[8.4cm]{%
\parbox[h][0.8cm][s]{8cm}{%
\tiny\sloppy
\let\\\linebreak
\parfillskip=0pt
THIS IS LINE 1 THIS IS LINE 1 THIS IS LINE 1\\
THIS IS LINE 2 THIS IS LINE 2 THIS IS LINE 2 THIS\\
THIS IS LINE 3 THIS IS LINE 3 THIS IS LINE 3 THI}}
--
Ulrike Fischer
Put the stretched boxes inside:
\fbox{\tiny\sffamily\bfseries
\begin{tabular}{l}% or \parbox, or a minipage
\makebox[8.4cm][s]{THIS IS LINE 1 THIS IS LINE 1 THIS IS LINE
1}\\
\makebox[8.4cm][s]{THIS IS LINE 2 THIS IS LINE 2 THIS IS LINE
2}\\
\makebox[8.4cm][s]{THIS IS LINE 3 THIS IS LINE 3 THIS IS LINE
3}
\end{tabular}
}
Dan
If I may, another question: I have the following code:
\parbox{16cm}{\framebox[16cm][c]{\huge \textbf{LINE 1}}}\newline
\parbox{16cm}{\framebox[16cm][c]{\huge \textbf{LINE 2 LINE 2 LINE 2}}}
\newline
How do I remove the vertical spacing between the two frames? In
appearance, I want it to look like to rows of a table with borders.
Thank you
I use the following to get text or even pictures in a box (framed or
not):
\noindent\makebox[\textwidth][t]{
\begin{minipage}[l]{.45\textwidth}
*content*
\end{minipage}
\hspace{\stretch{1}}
\begin{minipage}[r]{.45\textwidth}
*content*
\end{minipage}}
This is for horizontal alignment. the {.45\textwidth} gives the size
of the box relative to a complete line. For boxes flush against each
other it can be increased to .5\textwidth and the \hspace{\stretch{1}}
removed. The latter command spaces the boxes evenly. The \noindent
prevents the whole box setup from being indented from the left margin
(this can be quite a pain).
This setup can be manipulated to give good vertical seperation as
well.
You can set the minipages to be left aligned [l], centered [c] or
right aligned [r]. You will have to set the makebox location to be
either top [t], bottom [b] or here [h]. To have a \framebox, this
command can simply replace the \makebox.
To solve problem 2 you can try:
\noindent\makebox[\textwidth][t]{
\begin{minipage}[l]{.95\textwidth}
Line 1 \newline
Line 2 \newline
Line 3
\end{minipage}}
The .95\textwidth is to allow some spacing but this is just to appease
my aesthetic sense.
One nice thing about doing it this way is that the boxes now become
floats so you can move them around as a unit rather than risk them
being split over 2 pages.
Hope this is useful in some way.
Regards
Tyrone
\documentclass{scrreprt}
\begin{document}
\lineskip=0pt
\noindent
\parbox{16cm}{\framebox[16cm][c]{\huge \textbf{LINE 1}}}\newline
\parbox{16cm}{\framebox[16cm][c]{\huge \textbf{LINE 2 LINE 2 LINE 2}}}
\end{document}
--
Ulrike Fischer