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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
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