Skip to content

Instantly share code, notes, and snippets.

@Gavinok
Created January 24, 2021 18:56
Show Gist options
  • Save Gavinok/e1ebd4eb3a51a99322a5ed94f8cce3b2 to your computer and use it in GitHub Desktop.
Save Gavinok/e1ebd4eb3a51a99322a5ed94f8cce3b2 to your computer and use it in GitHub Desktop.
extra width coloured underline in groff
.\" eul.extra is the extra langth added to the start and end of the underline
.nr eul.extra 7
.\" eul.color set the color of the underline
.\" I made an explination of colors in groff here https://www.youtube.com/watch?v=LvLnht1v37g
.ds eul.color red
.de EUL
.\" eul.textwidth is the width of the text stored in the first argument
. nr eul.textwidth \\w'\\$1'
.
.\" \Z'commands' prints the following commands then resets the cursor to it's
.\" current loctation.
.\" \l'lengthu' prints a line of length `length` of type `u`
.\" \d moves the cursor down
.\" \u moves the cursor up
.
.\" 1. we are printing the extra part of the line at starting
.\" 2. we are printing the line which is the length of the text
.\" 3. we are printing the extra part of the line at the end
.\" 4. reset the cursor
.\" 5. print the given text
\Z'\
\d\
\m[\*[eul.color]]\
\l'\n[eul.extra]u'\
\l'\\n[eul.textwidth]u'\
\l'\n[eul.extra]u'\
\u'\
\m[]\
\\$1 \" print text in first argument
..
what is up
.EUL hello
with that man
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment