A text box can be useful when you want to move a text around in the document. It can emphasise the specific text on a research paper. We can use the \makebox to create a boxed text on a page in LaTeX.
However, many LaTeX users are still unaware of the ways to add a boxed text in the technical document. If you don’t know how to do it, read this tutorial thoroughly. We will explain the various ways to add and use a boxed text in LaTeX.
How to Use a Boxed Text in LaTeX
There are different types of boxed text that you can use in LaTeX. Here are some examples to explain everything briefly:
First, we use a simple example that includes the \makebox and \framebox:
\begin{document}
\fbox{Important Text in the Box}
\mbox{Please mention any specific text you want}\\
\end{document}
Output:
Similarly, you can also define the position of the boxed and normal text through the following source code:
\begin{document}
\makebox[2cm][c]{Some extra text}\\[8pt]
\framebox[5 cm][l]{Another important text}
\end{document}
Output:
The previous source code offers different options such as defining the line spacing, box length, text position, etc.
In case you want to put a complete paragraph in the box, use the following example source code:
\usepackage{blindtext}
\begin{document}
\blindtext\\
\fbox{\begin{minipage}{12 cm}
\blindtext
\end{minipage}}
\blinddocument
\end{document}
Output:
You can also colour the boxed text to highlight it more over the page. All you need to do is add the color \usepackage and \colorbox in your source code:
\usepackage{color}
\begin{document}
\colorbox{yellow}{\textcolor{black}{Important Information highlighted}}
\end{document}
Output:
Conclusion
There are various other types of boxes in LaTeX that are also useful to create a more impactful document. We explained everything in a simple manner using different examples. We recommend you to use the source codes carefully. Otherwise, you may get some errors while compiling the codes in the document processors.
from https://ift.tt/lxQBYqo
0 Comments