Text FormattingFloating text in a book

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
vikingo
Posts: 1
Joined: Tue Jun 02, 2015 11:08 pm

Floating text in a book

Post by vikingo »

I am working on a book using \documentclass[a4paper,12pt]{book}. I'd like to create some informational text boxes and 'float' them on the outside side of the page similar to an \includegraphics{} or an alertbox. These would be used at least once in each chapter to include important fyi type information that would complement the text. Any ideas on the best way to do this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Floating text in a book

Post by Johannes_B »

Hi and welcome,

you can use package tocbasic to define a new float-environment. Package tcolorbox may come in handy to draw a nice box.

Code: Select all

\documentclass{book}
\usepackage{blindtext}
\usepackage{tcolorbox}
\usepackage{tocbasic}
\DeclareNewTOC[
	float,
	type=FYI
]{fyi}
\begin{document}
\chapter{lambada leguan}
\blindtext[12][10]
\begin{FYI}\begin{tcolorbox}[title=For Your
	Information,colframe=red!50]
\blindtext\end{tcolorbox}
\end{FYI}
\blindtext[12][10]
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply