Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始化一下分支 #245

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"latex-workshop.latex.autoBuild.run": "onSave",
"latex-workshop.showContextMenu": true,
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name": "LaTeXmk",
"tools": [
"latexmk"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
],
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipe.default": "xelatex",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"
}
Binary file added TestFile.pdf
Binary file not shown.
53 changes: 53 additions & 0 deletions TestFile.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
\documentclass[lang=cn,10pt]{elegantbook}
\begin{document}
\tableofcontents

\chapter{这是我测试的第一个章节捏}
首先测试一下,能不能自定义一个环境吧~

\section{这是我测试的一个子章节}

我将在这个子章节这里进行我书籍的自定义环境的测试

先来一个mightguy环境试一试\ref{pro:你好}

\begin{proposition}\label{pro:你好}
duiduidui
\end{proposition}

\begin{theorem}
Theorem
\end{theorem}

\begin{lemma}
Lemma
\end{lemma}

\begin{corollary}
Corollary
\end{corollary}
\begin{mightguy}
首先请将上面那一条里面提到的自动清理中间文件的语句清除掉,保证你编译出来的报错信息能存下来。

LATEX的报错很奇葩,有时候它不会把报错信息输出到VSCODE的问题工作区里面,它只是单纯的无法编译出来结果然后P都不放一个,让人很烦,这时候我们就需要去.log文件里面搜索关键词error然后一个一个的找,看看包含这个单词的错误有多少,得到报错之后再一个一个的搜或者拿去问AI得到结果。

需要注意的是,先改正比较靠前的报错在该正比较靠前的错误。因为LATEX在报错后并不会停止编译文件,而是直接把整个文档编译完了然后把所有的报错都集中起来。所以说有时候一个报错会因为在原文中反复出现而出现十几一二十次,你先把报错文件最开始出现的报错解决掉,后面的报错可能就连带解决了。

如果你还是找不到问题所在的话,可以把你的项目压缩成一个压缩包然后把整个项目上传到OVERLEAF里面,首先这个网站的LATEX宏包非常非常的多,至少可以帮你规避掉一点没有安装某个宏包而引发的错误。其次这个网站在编译失败之后会把所有的失败文档分条归总起来,比一个一个的搜索要好很多。

如果你找到了问题所在,最好的解决方法不是直接去原文里面直接进行改正。你也看到了,木叶之秋这本书很长,合计起来有一两万字,如果你一开始就在原文里面进行改正的话,有很大的概率导致报错结果过长而难以找到你改了之后引发的次生灾害。

这时候就要把你的问题提炼出来,在另外一个分支里面写一个小项目进行改正(专注于某一个小BUG而写的这个项目其实也叫最小工作流程),在小项目里面解决掉这个问题之后再把解决方案汇总到木叶之秋这个大方案里面,这样才能高效地解决问题。

最后也是最重?要的一步就是,把你遇到的问题写到这个文档里面。毕竟你写下来的话总过是要比放到你那个不太充裕的记忆宫殿里面要有效得多,而且还能拿出来帮助后面的同学们。
\end{mightguy}


\customsf{bold}{你好}

\customsf{normal}{你好}

\begin{bluespace}
真的假的?
\end{bluespace}
\end{document}
158 changes: 158 additions & 0 deletions customclass.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
\ProvidesClass{customclass}[2024/09/12 Custom Class]

% Load the ctexart class
\LoadClass[UTF8]{ctexart}

% 导入所需的包
\RequirePackage{amsmath, amsthm, amssymb, amsfonts}
\RequirePackage{thmtools}
\RequirePackage{graphicx}
\RequirePackage{setspace}
\RequirePackage{geometry}
\RequirePackage{float}
\RequirePackage[english]{babel}
\RequirePackage{framed}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage[many]{tcolorbox}
\RequirePackage{xeCJK}
\RequirePackage{tikz}
\RequirePackage{indentfirst}
\RequirePackage{hyperref}
\RequirePackage{cleveref}
\RequirePackage{enumitem}
\RequirePackage{ifthen}
\RequirePackage{moresize}
\RequirePackage{graphicx}
\RequirePackage{pifont}

% 设置颜色
\definecolor{hashiramacolor}{RGB}{255,0,0}
\definecolor{tobiramacolor}{RGB}{169, 166, 171}
\definecolor{madaracolor}{RGB}{68, 89, 210}
\definecolor{mightguycolor}{RGB}{64, 111, 77}
\definecolor{talkcolor}{RGB}{34, 139, 34}
\definecolor{cqqcolor}{RGB}{252, 194, 0}
\definecolor{whitehatcolor}{RGB}{220,220,220}
\definecolor{bluespaceprojekt}{RGB}{100, 149, 237}
\definecolor{outsiderbackgroundcolor}{RGB}{50, 39, 27}
\definecolor{outsidertextcolor}{RGB}{245, 245, 220}

% 自定义命令
\newcommand{\customsf}[2]{%
\ifthenelse{\equal{#1}{bold}}{\textbf{\textsf{#2}}}{\textsf{#2}}%
}

% 段落首行缩进
\setlength{\parindent}{2em}

% 设置一个自定义命令,被用于设置封面的字体划线
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}}

% 将引用里面的section 更改为章节,免得出戏
\crefname{section}{章节}{章节}

% 设置默认文本框格式
\tcbset{
colframe=magenta,
colback=magenta!12!white,
boxed title style={colback=magenta},
breakable,
enhanced,
sharp corners,
boxsep=1pt,
attach boxed title to top left={yshift=-\tcboxedtitleheight, yshifttext=-.75\baselineskip},
boxed title style={boxsep=1pt,sharp corners},
fonttitle=\bfseries\sffamily,
drop lifted shadow
}

% 定义一个新的计数器
\newcounter{mytcbcounter}[section]
\renewcommand{\themytcbcounter}{\thesection.\arabic{mytcbcounter}}

\newcommand{\customtcolorbox}[4][]{%
\newtcolorbox[use counter=mytcbcounter, number within=section, number format=\arabic,#1]{#2}[1][]{
title={#3~\themytcbcounter},
colframe=#4,
colback=#4!12!white,
boxed title style={colback=#4},
overlay unbroken and first={
\node[below right,font=\small,color=#4,text width=.8\linewidth]
at (title.north east) {##1};
},
fontupper=\color{black},
before skip=8pt,
after skip=8pt,
before upper={\parindent=2em}
}
}

% 使用通用命令创建不同的 tcolorbox 环境
\customtcolorbox{madara}{宇智波斑}{madaracolor}
\customtcolorbox{outsider}{界外魔}{outsiderbackgroundcolor}
\customtcolorbox{justtalk}{火影新编}{talkcolor}
\customtcolorbox{hashirama}{千手柱间}{hashiramacolor}
\customtcolorbox{tobirama}{千手扉间}{tobiramacolor}
\customtcolorbox{mightguy}{迈特凯}{mightguycolor}
\customtcolorbox{cqq}{CQQ}{cqqcolor}
\customtcolorbox{whitehat}{白帽}{whitehatcolor}

\newtcolorbox{remark}[1][]{
title={\scalebox{1.75}{\raisebox{-.25ex}{\ding{43}}}~Remark},
colframe=yellow!45!white,
colback=yellow!45!white,
coltitle=Red,
fontupper=\sffamily,
boxed title style={colback=yellow!45!white},
boxed title style={boxsep=1ex,sharp corners},%%
overlay unbroken and first={
\node[below right,font=\normalsize,color=red,text width=.8\linewidth]
at (title.north east) {#1};
}
}

\newtcolorbox{note}[1][]{
title={\scalebox{1.75}{\raisebox{-0.1ex}{\ding{45}}}~Note},
colframe=yellow!45!white,
colback=yellow!45!white,
coltitle=Red,
fonttitle=\bfseries\sffamily,
% fontupper=\frfamily,
boxed title style={colback=yellow!45!white},
boxed title style={boxsep=1ex,sharp corners},%%
overlay unbroken and first={
\node[below right,font=\normalsize,color=red,text width=.8\linewidth]
at (title.north east) {#1};
}
}

\newtcolorbox[auto counter, number within=section]{bluespace}[1][]{
reset, % 这一句话可以重置掉所有的预设
title={\kaishu\scalebox{1.75}{\ding{99} \ding{99} 蓝色空间号
\ding{99} \ding{99}}}, % 设置标题样式
colframe=bluespaceprojekt, % 设置边框颜色
colback=bluespaceprojekt!12!white, % 设置背景颜色
coltitle=white, % 设置标题颜色
fontupper=\heiti, % 设置正文字体
boxed title style={colback=bluespaceprojekt!12!white}, % 设置标题框样式
boxed title style={boxsep=1ex,sharp corners}, % 设置标题框的边框间距和直角边框
% overlay unbroken and first={
% \node[below right,font=\normalsize,color=red,text width=.8\linewidth]
% at (title.north east) {#1}; % 在标题右上角显示自定义文本
% },
halign title=center, % 标题居中
before upper={\parindent=2em} % 设置首行缩进
}

% 设置文字行距,免得过于拥挤
\setstretch{1.2}

% 设置文字占用页面比例,免得页面过空
\geometry{
textwidth=5.5in,
top=1in,
bottom=0.7in,
headheight=12pt,
headsep=25pt,
footskip=30pt
}
Loading