Graphics, Figures & TablesDraw line around text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Michael_J
Posts: 2
Joined: Sat May 31, 2025 7:52 pm

Draw line around text

Post by Michael_J »

How would I draw the green line?

What I currently have
What I have now
What I have now
Without-Line.png (33.79 KiB) Viewed 4336 times
What I want
What I want
What I want
With-Line.png (37.76 KiB) Viewed 4336 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10317
Joined: Mon Mar 10, 2008 9:44 pm

Re: Draw line around text

Post by Stefan Kottwitz »

Hi Michael,

welcome to the forum!

You can use the tikzmark package for this.

Stefan
LaTeX.org admin
Michael_J
Posts: 2
Joined: Sat May 31, 2025 7:52 pm

Re: Draw line around text

Post by Michael_J »

Thanks for the information - I was able to figure it out.

If you are reading this {isOnline} is a bool that is a flag for either to generate answers for me or make a handout for students.

\usepackage{etoolbox} % for boolean flags
\newbool{isOnline} % true - Hide the answers in notes to worked problems
\setbool{isOnline}{false}


The stuff I added in the (\begin{tabular}{lll} ) block is as follows:

& \tikzmark{ExampleTwo}\ifbool{isOnline}{}{\textcolor{\BLUE}{$x\neq3$}} \\ [.5em]


& \ifbool{isOnline}{}{ %draw Green line.
\tikz[remember picture,overlay,baseline=0pt] \draw[line width=0.4mm, \GREEN, ->] ([shift={(-.5ex,.3ex)}]pic cs:ExampleTwo) to (-25ex,43ex) to (-25ex,0.5ex) to (-0.2em,0.2em);\textcolor{\BLUE}{$g(x)\neq1$}} \\ [.5em]
Post Reply