DEV Community

Cover image for How to make tags in Overleaf
Aiaru / 아야루
Aiaru / 아야루

Posted on

How to make tags in Overleaf

Recently, I have been updating my resume and decided to add technical skills as tags to increase readability. By the end of this post, you will learn how to draw tag-looking boxes around text in Overleaf, as shown in the picture below.

Image description

Step 1: Import required packages.

In order to create colorful boxes, we will use the tcolorbox package. If you want to know more about this package, you can check the reference here.

Import the package in the beginning of your document as follows:

\usepackage{tcolorbox}
\begin{document} ...
Enter fullscreen mode Exit fullscreen mode

Step 2: Define the colorbox for your document

To keep all "tags" consistent throughout the document and avoid defining them every time, you can set the dimensions as well as the color for your colorbox at the beginning of your document:

\usepackage{tcolorbox}
\tcbset{on line, boxsep=1pt, left=0pt,right=3pt,top=0pt,bottom=0pt,colframe=red, colback=red}
\begin{document} ...
Enter fullscreen mode Exit fullscreen mode

If we break down this line:
on line keeps your colorboxes inline with the rest of the text;
left,right,top, bottom are inner margins set to each side of the box;
boxsep adds an inner margin to all sides;
colframe defines the color of the box border;
colback defines the color of the box background;

Step 3: Use the color box inside your text.

Created interfaces using \tcbox{Figma}.
Enter fullscreen mode Exit fullscreen mode

The result would be as follows because it has a red border as well as a red background, and an additional 3px margin on the right:
one red tag

Step 4: Add custom colors for tags.

To add a personal touch to your document, you can add custom colors and use them in your boxes. To do so, add a custom color at the beginning of your document:

\definecolor{babyblue}{rgb}{0.82, 0.96, 0.936} 
\usepackage{tcolorbox}
\tcbset{on line, boxsep=1pt, left=0pt,right=3pt,top=0pt,bottom=0pt,colframe=babyblue, colback=babyblue}
\begin{document} ...
Enter fullscreen mode Exit fullscreen mode

In the example above, I added a color called babyblue using the unit RGB color system and replaced the colframe and colback colors with it.

Step 5: Add specific tags

If you want to highlight a specific colorbox by defining colors or other properties only for that instance, you can do so by adding properties inline. For example, if you want to color a specific box with a different color, you can use the following:
I can use \tcbox{HTML} and \tcbox[colframe=green, colback=green]{CSS}.

Result:
Image description

By repeating the same process, you can define various tags with different custom colors:

\textbf{Skills}\\
\tcbox{Tag1} \tcbox{Tag2} \tcbox[colframe=almond, colback=almond]{Language1} 
\tcbox[colframe=almond, colback=almond]{Language2} \tcbox[colframe=yellow, colback=yellow]{Technology1}
\tcbox[colframe=yellow, colback=yellow]{Technology2}
Enter fullscreen mode Exit fullscreen mode

Result:
Result

I hope this will be useful for your project ~.~

References:

Top comments (0)