class: center, middle, inverse, title-slide # Build html CV ## with R markdown ### Lin Yu ### University of Alberta ### 2021/08/23 (updated: 2021-09-21) --- # Motivation For fun; To reduce repetitive effort; To make it easier to share my CV with others; To have the most-recent CV ready! --- class: inverse, center, middle # Get Started --- # Install Package -- - Since you will need to use R markdown to write your CV, so you have to install the **rmarkdown** package if you have not install it: ```r install.packages("rmarkdown") library(rmarkdown) ``` -- - Then create a new .Rmd file by clicking `File - New File -> R Markdown` -- - edit your metadata as below:(you can also add pdf output as you want) ```r title: "" author: "" date: "" output: html_document ``` --- # Add CSS Chunk -- Why? - You might want to customize your CV in the same way that you would in Word or Google Docs. For example, you may see some text was centered, some was right aligned, and some was bold. The font size also seemed different. -- How? Easy:) You just need to add a css chunk in R markdown file right after the setup R chunk. See next slide. However, if you do not have experience with CSS style (like me). you need to spend some time on it. I learned basic CSS in [w3schools](https://www.w3schools.com/css/default.asp). --- # Add CSS Chunk (Continued) ```r {css echo=FALSE} h1 { text-align: center; text-transform: uppercase; color: steelblue; } h2 { text-transform: uppercase; color: #4CAF50; } .p1 { text-transform: uppercase; color: steelblue; font-size: 14px; } .p2 { font-size: 12px; } ``` --- #Add icons You might wish to include icons in your CV as well. I looked into two options for adding icons. (In fact, there are two packages) - method 1: [`icons` package](icons packages https://github.com/mitchelloharawild/icons ) ```r {r eval=FALSE} install.packages("remotes") remotes::install_github("mitchelloharawild/icons") icons::download_academicons() icons::download_fontawesome() ``` after installation, you need to use `downlaod_*()`function to load different icons. then run the r code:`icons::fontawesome("user-graduate", style = "solid")` you will get the following result: <svg viewBox="0 0 448 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M319.4 320.6L224 416l-95.4-95.4C57.1 323.7 0 382.2 0 454.4v9.6c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-9.6c0-72.2-57.1-130.7-128.6-133.8zM13.6 79.8l6.4 1.5v58.4c-7 4.2-12 11.5-12 20.3 0 8.4 4.6 15.4 11.1 19.7L3.5 242c-1.7 6.9 2.1 14 7.6 14h41.8c5.5 0 9.3-7.1 7.6-14l-15.6-62.3C51.4 175.4 56 168.4 56 160c0-8.8-5-16.1-12-20.3V87.1l66 15.9c-8.6 17.2-14 36.4-14 57 0 70.7 57.3 128 128 128s128-57.3 128-128c0-20.6-5.3-39.8-14-57l96.3-23.2c18.2-4.4 18.2-27.1 0-31.5l-190.4-46c-13-3.1-26.7-3.1-39.7 0L13.6 48.2c-18.1 4.4-18.1 27.2 0 31.6z"></path></svg> --- # Add icons (Continued) - Method 2: **fa** function in [`fontawesome` package](https://cran.r-project.org/web/packages/fontawesome/fontawesome.pdf) - Run the following inline R code ```r r fontawesome::fa(name = "envelope", fill = "steelblue",fill_opacity = 0.5, height = "1em") ``` ![](data:image/png;base64,#C:/20summer/blog/static/slides/write_cv_envelope.png) You can visit [fontawesome](https://fontawesome.com/) for more icons. --- # Right alignment - You can align your items to the right or left by altering the `<p>` tag setting. - for example, set `content to the right` and `content to the left` in the same line. <p style="display:inline;float:left" >content to the left<p/> <p style="display:inline;float:right">content to the right </p><br> <br> You can use the following codes: `<p style="display:inline;float:left" >content to the left<p/> <p style="display:inline;float:right">content to the right </p><br>` -- The `<br>` at the end represents `break`. This allows you to start a new line. --- # Some tips That is pretty much about it. Here are a few tips you should be aware of. -- - Use ` ` for space. for example, *There are several spaces between you me* ```r There are several spaces between you me ``` -- - Use `<br>` tag after inline passages as aforementioned, you can always start a new line by adding a `<br>` tag -- - Use `<!--section name-->` to add comments or session breaks -- - Finally, be familiar with CSS or html --- background-image: url(data:image/png;base64,#https://media4.giphy.com/media/fGU4lCGuH1sSffgNIE/200w.gif?cid=82a1493btnd325t1jxs7tfuglukb10rdhy9jzydo7b6h1b9n&rid=200w.gif&ct=g) background-position: 50% 40% class: center # I hope you find this helpful! --- class: center, middle, inverse # Thank you