# Add a box around text

I am trying to add text inside a box like this:

-------------------------------------------------------------------------------
# This is the section I am looking to do.

Paragraph here

1. point 1
1. point 2
1. point 3
-------------------------------------------------------------------------------


I am getting this:

But I really want this:

Basically, is there a way to format the text between these lines>

• Welcome to TeX.SX! Do you want to input that exact syntax (which looks like markdown syntax) or you just want that output? – Phelype Oleinik Apr 17 '19 at 18:37
• Yes, it is markdown syntax, I use pandoc to convert markdown to PDF. It would be best to use the syntax it is easier to work with, but if there is no way, I can use the regular latex syntax. – user1135541 Apr 17 '19 at 19:04

To use markdown syntax in LaTeX you can use, you guessed, the markdown package :-)

You just need to load the package and put the text in a markdown environment:

\documentclass{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
-------------------------------------------------------------------------------

# This is the section I am looking to do.

Paragraph here

1. point 1
1. point 2
1. point 3

-------------------------------------------------------------------------------
\end{markdown}
\end{document}


and then compile the document with -shell-escape enabled. And the output will be:

Notice however that there are some differences between proper markdown and the package. For instance, you need a blank line before and after the ---- lines to have them working properly.

• Is there a way to keep the section between the two lines on the same page? – user1135541 Apr 24 '19 at 19:16
• @user1135541 Not without changing the input a bit. Instead of a \section you would need a \begin{section}...\end{section} in order to have some control over the page breaking (see this thread, for example). That would be possible, except in markdown there is no such thing as \begin{section} unless you misused some other feature, like code fences. You can, however, make the whole markdown environment stay on one single page by wrapping it into a minipage or using one of the environments from the linked thread. – Phelype Oleinik Apr 26 '19 at 13:55