Skip to content

製作 CodeBook

這是一個超級懶人包建議你學習 git 的操作方法

A. GitHub

B. 建立你的倉庫

C. 打開網頁編輯頁面 (codespace)

如果你會使用 git,也可以 clone 到本地編輯

D. 將你的程式碼加到 codebook 中

  1. 將程式碼先放到資料夾中

    • 可以是 .cpp (程式碼)、 .tex (latex) 或其他文字檔案
  2. 更改 content.tex

    • 程式碼檔案用 lstinputisting
    • latex 檔案用 input
1
2
3
4
5
6
7
8
9
\section{Section1}
\subsection{basic}
    \lstinputlisting{Contents/section1/basic.cpp}
\subsection{test}
    \lstinputlisting{Contents/section1/test.cpp}

\section{Section2}
    \subsection{thm}
        \input{Contents/section2/thm.tex}

E. codebook.tex 中可設定的地方

  • 修改個人、隊伍資訊
    • \fancyhead[C] 是中間的標題
    • \fancyhead[L] 是左邊的標題
1
2
\fancyhead[C]{標題一}
\fancyhead[L]{標題二}

F. 上傳到 GitHub

  1. git add
  2. git commit
    • 可以打一些 commit 訊息(例如:add kruskal's algorithm)
  3. git push(網頁編輯器不需要 push)

G. 查看結果

  • 等待 1 分鐘左右
  • 切換到 pdf branch

補充:在本地開發

熟悉 Git 的讀者,也可以選擇在本地修改。

  • 在 Github 新增專案

  • clone 此專案在本地

    1
    git clone https://github.com/FjuOnlineJudge/CodeBook-Sample.git
    

  • 上傳到你所新增的新專案

    1
    2
    3
    4
    5
    6
    7
    8
    cd CodeBook-Sample
    rm -rf .git
    git init
    git add .
    git commit -m "init files"
    git branch -M main
    git remote add origin https://github.com/Yourname/new-repository.git
    git push -u origin main