Skip to content

Commit

Permalink
Merge pull request #81 from MIngPAPA/feat/draftmode
Browse files Browse the repository at this point in the history
feat:添加draftmode
  • Loading branch information
liziwl authored Oct 6, 2024
2 parents 26a4ef0 + 4ca64b7 commit c0fc7a9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
38 changes: 37 additions & 1 deletion sustech-setup.tex
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,40 @@


\newcommand\undefcolumntype[1]{\expandafter\let\csname NC@find@#1\endcsname\relax}
\newcommand\forcenewcolumntype[1]{\undefcolumntype{#1}\newcolumntype{#1}}
\newcommand\forcenewcolumntype[1]{\undefcolumntype{#1}\newcolumntype{#1}}



% 定义draft模式的条件
\newif\ifdraftmode
\draftmodefalse % 默认关闭draft模式

% 定义一个命令来开启draft模式
\newcommand{\enabledraftmode}{%
\draftmodetrue
\PassOptionsToPackage{draft}{graphicx}
\PassOptionsToPackage{draft}{hyperref}
\ifdefined\oldincludegraphics\else
\let\oldincludegraphics\includegraphics
\fi
\renewcommand{\includegraphics}[2][]{%
\begingroup
\def\draftimagearg{##2}%
\def\draftimageopts{##1}%
\sbox0{\oldincludegraphics[##1]{##2}}%
\fbox{\parbox[c][\ht0]{\wd0}{\centering Draft Image:\\\texttt{\draftimagearg}}}%
\endgroup
}
\overfullrule=5pt % 显示溢出的箱子
}

% 定义一个命令来关闭draft模式(如果需要的话)
\newcommand{\disabledraftmode}{%
\draftmodefalse
\PassOptionsToPackage{final}{graphicx}
\PassOptionsToPackage{final}{hyperref}
\ifdefined\oldincludegraphics
\let\includegraphics\oldincludegraphics
\fi
\overfullrule=0pt
}
1 change: 1 addition & 0 deletions sustechthesis-example-report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
% 5. 作者姓名、指导教师等
\input{sustech-setup}

% \enabledraftmode % 启用草稿模式,会以文字占位符替代图片,加快大量插入大尺寸图片时的编译速度,用于学位论文的调试,默认不启用

\begin{document}

Expand Down
1 change: 1 addition & 0 deletions sustechthesis-example.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
% 5. 修改degree-type的值, 默认academic代表生成学术型研究生毕业设计模板, 改为professional则将生成专业型研究生毕业设计模板。
\input{sustech-setup}

% \enabledraftmode % 启用草稿模式,会以文字占位符替代图片,加快大量插入大尺寸图片时的编译速度,用于学位论文的调试,默认不启用

\begin{document}

Expand Down

0 comments on commit c0fc7a9

Please sign in to comment.