主要涉及本人在 LATEX 使用中遇到的问题和解决的办法,不定期更新。 目前打算的内容有:
主要是在Windows、MacOS系统下使用,偶尔在Linux平台(Ubuntu)下使用。因此所有使用软件都以跨平台为基础标准。目前使用的是Atom+TexLive的组合(以前一直用Sublime+TexLive,但Sublime Text 在Ubuntu平台的中文输入法很让人头疼,加上其他一些原因,放弃)
常用的应该是MikTex和Texlive两类。中文Ctex套装中封装的是MikTex。但TexLive在Linux和Mac平台都有对应的支持(此处有误,Mac下为Macshop,编辑器为TexShop,参见中文版LaTeX排版)。在Windows平台下选择两者皆可。 在Windows平台下,我同时安装了两种软件,编译时选择任何一个即可。Windows平台下的安装没有什么难度。
将来补充
在tex文件中加入
\usepackage{ctex}
并且使用xelatex的编译方式(通常为pdfLATEX)。
参见StackExchange中这个问题的讨论 Where do I place my own .sty or .cls files, to make them available to all my .tex files?
There are two parts to telling TeX about a new .sty file. First, you have to put it in the 'right' place and second you need to update the database TeX uses to find files. The place to put the file depends on your operating system. Assuming you have a standard installation, this will probably be:
- Windows 10 (and miktex)
C:\Users\\Appdata\Local\MikTex\<number>\tex\$\LaTeX$\local\
- Windows Vista/7
C:\Users\\texmf\tex\$\LaTeX$\local\
- Windows XP
C:\Documents and Settings\\texmf\tex\$\LaTeX$\local\
- Linux
~/texmf/tex/$\LaTeX$/local/
- Mac OS X
/Users//Library/texmf/tex/$\LaTeX$/local/
Note: the local/ folder might not exist; in this case, go ahead and create it.
也就是说,texlive会自动的识别一些特殊的路径作为local .bst文件,.sty文件的存放位置。对应的在C:\Users\
\texmf\tex$\LaTeX$\local\ 这里建立起来各层路径,将对应的sty文件bst文件放入后,就可以在所有本机的tex文档中调用了。
此外,在texmf路径下,还拷贝了其他文件夹,包括:
主要选择了Atom作为编辑器,可以很好的支持Git,同时拥有很多扩展。
没有技术难度
相关的重要设置:
LATEX:
$\LaTeX$
主要是使用package todonotes 例如,可以参考StackExchange中的这个问题的讨论: How to add todo notes?
The todonotes package mentioned above can be customized to show various types of notes. It is also possible to create a summary of all notes, for example at the end of the document. Here is an example:
\documentclass{article} \usepackage{lipsum} % Dummytext \usepackage{xargs} % Use more than one optional parameter in a new commands \usepackage[pdftex,dvipsnames]{xcolor} % Coloured text etc. % \usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes} \newcommandx{\unsure}[2][1=]{\todo[linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}} \newcommandx{\change}[2][1=]{\todo[linecolor=blue,backgroundcolor=blue!25,bordercolor=blue,#1]{#2}} \newcommandx{\info}[2][1=]{\todo[linecolor=OliveGreen,backgroundcolor=OliveGreen!25,bordercolor=OliveGreen,#1]{#2}} \newcommandx{\improvement}[2][1=]{\todo[linecolor=Plum,backgroundcolor=Plum!25,bordercolor=Plum,#1]{#2}} \newcommandx{\thiswillnotshow}[2][1=]{\todo[disable,#1]{#2}} % \begin{document} > \pagestyle{empty} > \todo[inline]{The original todo note withouth changed colours.\newline Here's another line.} > \lipsum[11]\unsure{Is this correct?}\unsure{I'm unsure about also!} > \lipsum[11]\change{Change this!} > \lipsum[11]\info{This can help me in chapter seven!} > \lipsum[11]\improvement{This really needs to be improved!\newline\newline What was I thinking?!} > \lipsum[11] > \thiswillnotshow{This is hidden since option `disable' is chosen!} > \improvement[inline]{The following section needs to be rewritten!} > \lipsum[11] > \newpage > \listoftodos[Notes] > \end{document}
Note: LATEX命令\lipsum是生成随机文本的意思 Notice the \thiswillnotshow note which is disabled using the disable option in the header. This can be used to turn off each type of note globally. Todonotes can also be used in the caption of tables and figures, though only provided that the inline option is used with these notes.
You can also add a todo note with an incrementing counter for each note, using the following code: \newcounter{todocounter} \newcommandx{\todocount}[2][1=]{\stepcounter{todocounter}\todo[linecolor=YellowGreen,backgroundcolor=YellowGreen!25,bordercolor=YellowGreen,#1]{\thetodocounter: #2}}
但如果是要递增counter,可以参考Sharpe Ratio project中的写法,这里实现了三个人可以分别点评
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath}
\usepackage{graphicx}
%\usepackage{epsfig}
\usepackage{float}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{threeparttable}
\usepackage{pdfpages}
\usepackage{lscape}
\usepackage{marginnote} % Used with todonotes package
\usepackage{datetime} % Allows formatting of date and time
\usdate % Use usual LaTeX date layout
\usepackage{enumitem} % List formatting commands
\setlist{noitemsep} % Remove space between list items
\usepackage{subfigure} % Create numbered and captioned subfigures
\usepackage{rotating} % Create landscape tables and figures
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage[hidelinks, colorlinks=false, urlcolor=blue,citecolor=black]{hyperref} % URLS and hyperlinks
\usepackage{longtable}
\usepackage{indentfirst}
\usepackage{appendix}
\usepackage[font=large,labelfont=bf,up,textfont=small, justification=justified,singlelinecheck=false,up]{caption}
\usepackage{fancyhdr}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{supertabular,booktabs}
\usepackage{array}
\usepackage[longnamesfirst]{natbib}
\usepackage{xcolor}
\usepackage{authblk}
\usepackage{versionPO} % Include text conditionally
\usepackage{subfigure}
\usepackage{mathtools, cases}
\includeversion{notes} % Include notes?
%\excludeversion{notes}
\excludeversion{comment}
\includeversion{links} % Turn hyperlinks on?
% \includeversion{submit} % Format for conference submission?
\excludeversion{submit} % Format for conference submission?
%\includeversion{toc} % Include table of contents?
% Turn off hyperlinking if links is excluded
\iflinks{}{\hypersetup{draft=true}}
% Notes options
\ifnotes{%
\usepackage[margin=1in,paperwidth=10in,right=2.5in]{geometry}%
\usepackage[textwidth=1.4in,shadow,colorinlistoftodos]{todonotes}%
\usepackage{menukeys}
}{%
\usepackage[margin=1in]{geometry}%
\usepackage[disable]{todonotes}%
}
% Define commands for making a table
\newcolumntype{P}[1]{>{\raggedright}p{#1}}
\newcommand{\tn}{\tabularnewline}
% Define note commands
\newcommand{\smalltodo}[2][] {\todo[caption={#2}, size=\small, fancyline, #1] {\begin{spacing}{.5}#2\end{spacing}}}
\newcommand{\rhs}[2][]{\smalltodo[color=red!30,#1]{{\bf YT:} #2}}
\newcommand{\rhes}[2][]{\smalltodo[color=green!30,#1]{{\bf CJ:} #2}}
\newcommand{\rhfs}[2][]{\smalltodo[color=blue!30,#1]{{\bf XX:} #2}}
\newcounter{todocounterYT}
\newcounter{todocounterCJ}
\newcounter{todocounterXX}
\newcommand{\YT}[2][]{\stepcounter{todocounterYT}\rhs[#1]{\thetodocounterYT:#2}}
\newcommand{\CJ}[2][]{\stepcounter{todocounterCJ}\rhes[#1]{\thetodocounterCJ:#2}}
\newcommand{\XX}[2][]{\stepcounter{todocounterXX}\rhfs[#1]{\thetodocounterXX:#2}}
\newcommand{\rhsnolist}[2][]{\smalltodo[nolist,color=green!30,#1]{{\bf YT:} #2}}
\newcommand{\rhsfn}[2][]{% To be used in footnotes (and in floats)
\renewcommand{\marginpar}{\marginnote}%
\smalltodo[color=green!30,#1]{{\bf YT:} #2}%
%
% \newcommand{\rhsnolist}[2][]{\smalltodo[nolist,color=green!30,#1]{{\bf XX:} #2}}
% \newcommand{\rhsfn}[2][]{% To be used in footnotes (and in floats)
% \renewcommand{\marginpar}{\marginnote}%
% \smalltodo[color=green!30,#1]{{\bf XX:} #2}%
\renewcommand{\marginpar}{\oldmarginpar}}
\newcommand{\textnote}[1]{\ifnotes{{\colorbox{yellow}{{\color{red}#1}}}}{}}
\renewcommand{\marginpar}{\marginnote}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\makeatletter\let\chapter\@undefined\makeatother % Undefine \chapter for todonotes.
未完待续