index.html (10645B)
1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script><title>Guide to Markdown with Pandoc – Fedor_Vinogradov</title> 5 <meta name="description" content="I prefer matrix over anything."> 6 7 <meta name="viewport" content="width=device-width, initial-scale=1"> 8 <meta charset="UTF-8"/> 9 10 11 12 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> 13 14 15 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/academicons/1.9.4/css/academicons.min.css" integrity="sha512-IW0nhlW5MgNydsXJO40En2EoCkTTjZhI3yuODrZIc8cQ4h1XcF53PsqDHa09NqnkXuIe0Oiyyj171BqZFwISBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> 16 17 18 <link rel="stylesheet" href="http://localhost:1313/css/palettes/nord-dark.css"> 19 <link rel="stylesheet" href="http://localhost:1313/css/risotto.css"> 20 <link rel="stylesheet" href="http://localhost:1313/css/custom.css"> 21 22 23 24 25 26 27 28 29 30 31 </head> 32 33 <body> 34 <div class="page"> 35 36 <header class="page__header"><nav class="page__nav main-nav"> 37 <ul> 38 <li class="nomarker"><h1 class="page__logo"><a href="http://localhost:1313/" class="page__logo-inner">Fedor_Vinogradov</a></h1></li> 39 40 41 <li class="main-nav__item"><a class="nav-main-item" href="http://localhost:1313/projects/" title="">Projects</a></li> 42 43 <li class="main-nav__item"><a class="nav-main-item" href="http://localhost:1313/posts/" title="">Posts</a></li> 44 45 </ul> 46 </nav> 47 48 </header> 49 50 <section class="page__body"> 51 <header class="content__header"> 52 <h1>Guide to Markdown with Pandoc</h1> 53 </header> 54 <div class="content__body"> 55 <p>In this post I will describe my setup that I use to write papers and make presentations with pandoc. My approach to these are quite unique, but simple. The main idea is to use Neo Vim to write the text, and then quickly have a fully formatted PDF document or a presentation.</p> 56 <p><img src="/images/pdfDocumentExample.png" alt="demonstration of a compiled file"></p> 57 <p>Above you can see and example of a markdown document after I compile it with Pandoc.</p> 58 <h2 id="tools-that-i-use">Tools That I Use.</h2> 59 <ul> 60 <li><strong>Nvim</strong>: my text edit or choice</li> 61 <li><strong>Pandoc</strong>: Markdown to PDF converter</li> 62 <li><strong>Zathura</strong>: minimalistic PDF viewer</li> 63 </ul> 64 <h2 id="writing-papers">Writing papers</h2> 65 <h3 id="nvim-setup">Nvim setup</h3> 66 <p>While I will briefly go over some of my nvim extensions, they are not the main focus of this post since they are not crucial for my setup but do make the whole process smoother.</p> 67 <ul> 68 <li><strong>toggleterm</strong>: A popup terminal for nvim, Really handy to run a custom pandoc command without exiting nvim.</li> 69 <li><strong>neo-tree</strong>: I dont use it as often, but it often comes in handy when I need to quickly see the file layout or to grap the name of a picture.</li> 70 <li><strong>marksman</strong>: Markdown lsp server of choice.</li> 71 </ul> 72 <h4 id="shortcuts">Shortcuts</h4> 73 <p>I have a viewer shortcut. All it does is open the PDF file with the same name as the markdown file but wihtout the “.” at the start.</p> 74 <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span><span style="color:#a6e22e">zathura</span> %:<span style="color:#a6e22e">r</span>:<span style="color:#a6e22e">s</span><span style="color:#e6db74">/^./</span>/.<span style="color:#a6e22e">pdf</span><<span style="color:#a6e22e">CR</span>> 75 </span></span></code></pre></div><p>The main part of my Nvim setup is the shortcut that compules my markdown file into a PDF. The shortcut simply trigers the follwing bash command:</p> 76 <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span><span style="color:#a6e22e">pandoc</span> -<span style="color:#a6e22e">H</span> ~<span style="color:#e6db74">/Full/</span><span style="color:#a6e22e">path</span><span style="color:#e6db74">/to/</span><span style="color:#a6e22e">header</span>.<span style="color:#a6e22e">tex</span> --<span style="color:#a6e22e">pdf</span>-<span style="color:#a6e22e">engine</span>=<span style="color:#a6e22e">xelatex</span> -<span style="color:#a6e22e">o</span> %:<span style="color:#a6e22e">r</span>:<span style="color:#a6e22e">s</span><span style="color:#e6db74">/^./</span>/.<span style="color:#a6e22e">pdf</span> %:<span style="color:#a6e22e">r</span>.<span style="color:#a6e22e">md</span><<span style="color:#a6e22e">CR</span>> 77 </span></span></code></pre></div><p>Every markdown file that i plan to compile with pandoc, is always a hidden file. this allows the directory to look cleaner when you open it, and still keep the ability to edit the md files.</p> 78 <ul> 79 <li> 80 <p><code>--pdf-engine=xelatex</code> –> Is the engine that pandoc uses to compile the PDF.</p> 81 </li> 82 <li> 83 <p><code>-o %:r:s/^.//.pdf %:r.md</code> –> This is the output file, and the input file. The output file is the same as the input file, but with the first character removed. This is done to remove the hidden character ( . ) from the file name.</p> 84 </li> 85 <li> 86 <p><code>-H ~/Full/path/to/header.tex</code> –> Is a reference to a custom header file that I use to style my PDFs.</p> 87 </li> 88 </ul> 89 <h3 id="headertex-file">header.tex file</h3> 90 <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-latex" data-lang="latex"><span style="display:flex;"><span> <span style="color:#66d9ef">\usepackage</span>{fontspec} 91 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\setmainfont</span>{Atkinson Hyperlegible} 92 </span></span><span style="display:flex;"><span> 93 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\usepackage</span><span style="color:#a6e22e">[left=2cm,right=2cm]</span>{geometry} 94 </span></span><span style="display:flex;"><span> 95 </span></span><span style="display:flex;"><span> 96 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\usepackage</span>{xcolor} 97 </span></span><span style="display:flex;"><span> 98 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\definecolor</span>{linequote}{RGB}{245,245,245} <span style="color:#75715e">% Very light gray 99 </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> <span style="color:#66d9ef">\definecolor</span>{backquote}{RGB}{245,245,245} <span style="color:#75715e">% Very light gray 100 </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> <span style="color:#66d9ef">\definecolor</span>{bordercolor}{RGB}{220,220,220} <span style="color:#75715e">% Light gray 101 </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> 102 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\usepackage</span>{mdframed} 103 </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">\surroundwithmdframed</span><span style="color:#a6e22e">[linecolor=linequote,backgroundcolor=backquote,linewidth=2pt]</span>{quote} 104 </span></span></code></pre></div><p>This is the header file that I use to style my PDFs. <code>\setmainfont{Atkinson Hyperlegible}</code> is the font that I use for my PDFs. It is a free font that is designed to be easy to read, perfect for long skimming large documents.</p> 105 <p>I also set the margins and basic styling for the quotes.</p> 106 <h3 id="workflow">Workflow</h3> 107 <ol> 108 <li>I create a markdown file with a “.” at the start of the file name.</li> 109 <li>I write my report/paper</li> 110 <li>I compile the markdown file with the pandoc shortcut.</li> 111 <li>I open the PDF with the zathura shortcut when i need to view it.</li> 112 </ol> 113 <h2 id="making-presentations">Making Presentations</h2> 114 <p>In order to make presentations, I use the same setup as I do for writing papers. The only difference is that indead of a header file, I place a <strong>beamer theme</strong> and and <strong>bash script</strong> in the same directory as the markdown file</p> 115 116 </div> 117 <footer class="content__footer"></footer> 118 119 </section> 120 121 <section class="page__aside"> 122 <div class="aside__about"> 123 <div class="aside__about"> 124 125 126 <h1 class="about__title">My Socials</h1> 127 <p class="about__description">I prefer matrix over anything.</p> 128 </div> 129 130 131 <ul class="aside__social-links"> 132 133 <li> 134 <a href="" rel="me" aria-label="SourceHut" title="SourceHut"><i class="fa-regular fa-circle" aria-hidden="true"></i></a> 135 </li> 136 137 <li> 138 <a href="https://matrix.to/#/@fedorvin:matrix.org" rel="me" aria-label="Matrix" title="Matrix"><i class="fa-regular fa-comment" aria-hidden="true"></i></a> 139 </li> 140 141 <li> 142 <a href="/index.xml" rel="me" aria-label="RSS" title="RSS"><i class="fa-solid fa-rss" aria-hidden="true"></i></a> 143 </li> 144 145 <li> 146 <a href="mailto:vino-f@pm.me" rel="me" aria-label="Email" title="Email"><i class="fa-regular fa-envelope" aria-hidden="true"></i></a> 147 </li> 148 149 <li> 150 <a href="https://linkedin.com/in/fedor-vinogradov-b4454219a" rel="me" aria-label="LinkedIn" title="LinkedIn"><i class="fa-brands fa-linkedin-in" aria-hidden="true"></i></a> 151 </li> 152 153 </ul> 154 <hr> 155 <div class="aside__content"> 156 <p>A guide for how i make all of my documents</p> 157 158 <p> 159 160 2024-11-02 161 </p> 162 163 164 165 166 167 <nav id="TableOfContents"> 168 <ul> 169 <li><a href="#tools-that-i-use">Tools That I Use.</a></li> 170 <li><a href="#writing-papers">Writing papers</a> 171 <ul> 172 <li><a href="#nvim-setup">Nvim setup</a></li> 173 <li><a href="#headertex-file">header.tex file</a></li> 174 <li><a href="#workflow">Workflow</a></li> 175 </ul> 176 </li> 177 <li><a href="#making-presentations">Making Presentations</a></li> 178 </ul> 179 </nav> 180 181 </section> 182 183 <footer class="page__footer"> 184 <p class="copyright"></p> 185 </footer> 186 187 </div> 188 </body> 189 190 </html>