LaTex 學習筆記

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   使用   ar   strong   for   

  基礎使用:

  • \documentclass[UTF8]{ctexart} UTF8可省略。ctexart為支援中文的文章,若改為article則不顯示中文。
    • \title{……}
    • \author{ooyyloo}
  • \begin{document}
    • \maketitle
    • ……
    • \section{文字}
    • \[ a^2+b^2=c^2 \]

  • \end{document}

 

  插入代碼:

  在中插入代碼需要包含listings宏包,而想要代碼高亮需要xcolor宏包。

  在導言區加入listings和xcolor宏包,並對其設定。

\usepackage{listings} %插入代碼\usepackage{xcolor} %代碼高亮 \lstset{numbers=left, %設定行號位置        numberstyle=\tiny, %設定行號大小        keywordstyle=\color{blue}, %設定關鍵字顏色        commentstyle=\color[cmyk]{1,0,1,0}, %設定注釋顏色        frame=single, %設定邊框格式        escapeinside=``, %逃逸字元(1左面的鍵),用於顯示中文        breaklines, %自動折行        extendedchars=false, %解決代碼跨頁時,章區段標頭,頁首等漢字不顯示的問題        xleftmargin=2em,xrightmargin=2em, aboveskip=1em, %設定邊距        tabsize=4, %設定tab空格數        showspaces=false %不顯示空格       }

 

  文章中需要插入代碼時可以這樣使用:

\begin{lstlisting}[language=C]/* helloworld.c */#include <stdio.h>int main(){    printf("Hello World!\n");    return 0;}\end{lstlisting}

  (參考網址:http://blog.thebeyond.name/archives/33)

 

LaTex 學習筆記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.