jiangdm的个人博客分享 http://blog.sciencenet.cn/u/jiangdm

博文

latex使用

已有 23855 次阅读 2010-8-17 00:03 |个人分类:Tools|系统分类:论文交流| Ctex, JabRef, beamer

Contents
1 CTex
[1] CTex作图
[2] sumatra PDF
2 JabRef and EndNote
3 InkScape
4 Word & Visio
5 Version Control

6 Beamer

7 Latex 个人简历模板

1 CTex {注:CTex是Full版,正在学习CTex,为以后写论文做准备。}
[1-] CTex作图:
 工具:LaTeXDraw, Dia,PsTricks, WinFig, XFig,  OpenOffice.org Draw 组件, Inkscape
       gnuplot: 开源作图软件
[2] sumatra PDF: a pdf reader for window
更新sumatra PDF, 可直接将sumatra PDF可执行文件移动到Ctex的bin文件夹中,覆盖原文件即可:
 如:C:Program Files (x86)CTEXCTeXctexbin
 
定理环境
 newtheorem{theorem}{定理}[section]
 newtheorem{definition}{定义}[section]
 newtheorem{lemma}{引理}[section]
 newtheorem{corollary}{推论}[section]
 newtheorem{proposition}{性质}[section]
 newtheorem{example}{例}[section]


例如:CTex中,newtheorem{myExp}{Example}[section]            

        begin{myExp}
          $Email(a,m) < m < (Bing(w) | Yahoo(w))$

      end{myExp}        

 newtheorem{remark}{注}[section]
    如果文档类型为book或者report,应将主计数器改为chapter
begin{definition}
  A vector $a$ is said to be a subgradient of $g(y)$ at if
 begin{equation}label{sub}
   f(x) geq f(x_{0}) + a^{T}(x-x_{0})
 end{equation}
 end{definition}



CTex证明环境

defQEDclosed{mbox{rule[0pt]{1.3ex}{1.3ex}}} % 定义实心符
defQEDopen{{setlength{fboxsep}{0pt}setlength{fboxrule}{0.2pt}fbox{rule[0pt]{0pt}{1.3ex}rule[0pt]{1.3ex}{0pt}}}} %定义空心符
defQED{QEDopen} % 选填QEDclosed得到实心
defproof{noindent{bf Proof}: } %定义证明,注意选择中英文
defendproof{hspace*{fill}~QEDparendtrivlistunskip}%在proof环境自动添加结束符。
%
begin{proof}
[证明内容]
end{proof}


 latex中的逻辑等价符号: modelshspace{-.5em}|~    
 百分号输出  %
 LaTeX里面,井号属于特殊字符,我们如果要在输出的文档中使用它,必须要用#而不是#
       或者$sharp$
 Q: CTex插入eps,pdf图片,但是编译后PDF看不到插图
 A: 先 latex,再 dvips, 最后 ps2pdf  (Tex Menu)
 Q: ctex花体拉丁字母:
 A: usepackage{mathrsfs} + mathscr{F}
 Latex表格:  latex_table_demo.tex
 Article Style:
 -- LNCS:    LNCS typeinst.zip
 --
   
   使用Ctex 的WinEdt6.0 TexLive打开科技论文在线中文模板的tex文件,其中中文字显示乱码。

   针对该问题的解决方法为

   如果你的Ctex软件版本够高。可将tex文件的第一行代码

   documentclass[UTF8]{csoarticle}
    改为

   usepackage[utf8]{inputenc}
    即可。

   原Latex template加入usepackage{color}
   编译通不过: ERROR: Undefined control sequence
      solution:
           把begin{CJK}{UTF8}{song}
           放begin{document}下面
   章节起始页为奇数页或者偶数页在LaTeX中可以非常方便的设置。起始页为奇数页被称作”Open-right”,若为连续则称作”Open-any”。
   例如:documentclass[showtypeinfo] 改为 documentclass[showtypeinfo,openany]

问题:每次打开WinEdt都是空目录,关闭程序时提示“Error saving the project file:…”


解决办法:win8系统下,没有写入文件夹权限导致。

Options -> Configuration Wizard -> User Profiles. 点击 Create User Profile 按钮

重启WinEdt


WinEdt 6 + SumatraPDF反向搜索功能:

解决方法如下:Option ->PDF viewer -> 选择 Sumatra PDF

                           Execution Modes -> Apply all

xelatex编译报错, ERROR: xeCJK error: "l3-too-old"

           Support package 'expl3' too old.


reason: WinEdit调用的userdata%下的texlatexl3kernelexpl3.sty
    而不是安装目录下的texlatexl3kernelexpl3.sty (更新过)

   更新所有包的时候装到了安装目录下,同一个包装了两遍出了冲突

   将更新过的package复制到%appdata%下的texlatexl3kernel


WinEdt 6.0更改字体或字号技巧  :  http://blog.sina.com.cn/s/blog_5e16f1770100o3kp.html
latex 加入算法伪代码  algorithms latex.pdf

  是因为对于algorithm环境是有自己的字体设置,不会受tiny的影响。可以采用将

algsetup{linenosize=tiny}scriptsize加入到begin{algorithm}后。当然其中的tiny可以换成以上的任意一种

latex 加入List

usepackage{listings}
usepackage{xcolor}
lstset{basicstyle=ttfamily,
 showstringspaces=false,
 commentstyle=color{red},
 keywordstyle=color{blue}
}


例子:

begin{lstlisting}[language=C++,caption={C++ version}label{...}]
void main()
{
   printf("hello world");
}
end{lstlisting}

效果:

    ref:  latex的宏包之显示程序代码  

       http://tjjelly.blog.163.com/blog/static/50587684201141010138279/


   


Q:几个作者同时共享机构地址,怎么搞
A:拿ACM的模版为例
 defsharedaffiliation{end{tabular} begin{tabular}{c}}
 then adjust your particular ‘author block’ like so (example shown for 3 authors)
 
   title{Alternate {ttlit ACM} SIG Proceedings Paper in LaTeX Formattitlenote{(Produces...}}
   numberofauthors{3} % Three authors sharing the same affiliation.
   author{ alignauthor Ben King\
     email{king@cs.berkeley.edu} %
   alignauthor Georgia Tobin\
     email{tobin@cs.berkeley.edu} %
   alignauthor Gerald Murray\
     email{murrray@cs.berkeley.edu} %
   sharedaffiliation
   affaddr{Department of Electrical Engineering and Computer Science } \
   affaddr{University of California, Berkeley } \
   affaddr{Berkeley, CA 94720-1776 } } %
 maketitle
[2-] CTex template
 ACM SIG (eg. WWW):  acm SIG eg WWW.rar
[3-] CTex 与 PPT:
若安装:
1. CTex --> MikTex ---> Package Manager ,在宏包列表中安装beamer,xcolor,pgf三个宏包,
       beamer
       pgf: 支持多种图片格式的插入,可以用在写其他latex论文,
       xcolor:
范例:    beamer_example.rar

 Web Site:
 1-. 国内CTeX论坛,TeX初学者首选
 2-. www.ctan.org    
 3-. LaTeX 编辑部
 4-. LaTeX-学习园地: http://blog.sina.com.cn/wangzhaoli11
   LATEX论文排版学习资源汇总    http://bbs.sciencenet.cn/thread-1193405-1-1.html
         http://blog.sciencenet.cn/blog-723494-688630.html  总汇latex常用格式
Latex 并排图
 -- 用sugfigure package
 -- minipage
 example:
begin{figure}[h]
begin{minipage}[t]{0.5linewidth}
centering
includegraphics[width=1cm]{yourfig1}
caption{图名1} label{tu7-30}
end{minipage}
begin{minipage}[t]{0.5linewidth}
centering
includegraphics[width=1cm]{yourfig2}
caption{图名2} label{tu7-31}
end{minipage}
end{figure}

大家來學LATEX.pdf


Latex语法检测:chktex-1.7.2.tar.gz

可惜只能用于Linux系统,Windows却没有?


编译  黄正华的武汉大学博士论文 2013 版,用 XeLaTex编译报错:

   l.836 xeCJK@setmacro@define@key{ItalicFont}

- 原来是版本冲突,fontspec 2.2 版与 xeCJK 2.4.2 及以前的版本不兼容,会出现编译错误。

   http://bbs.ctex.org/forum.php?mod=viewthread&tid=66546

- 即删除  X:CTeX安装目录CTeXtexxelatexxecjk


- Q: phd  thesis 报错: undefined control sequence  theorempreskip

       reason: ntheorem package obsolete,

       Your example works fine for me even if I uncomment theorempreskip and theorempostskip. Section 2.3.5 of the ntheorem documentation indicates that these commands were introduced in version 1.32; older versions handled spacing differently and used the commands theorempreskipamount and theorempostskipamount. Your problem is very likely caused by an obsolete ntheorem version; try to either update your TeX distribution or see if the old macros (including "amount" in their name) produce acceptable spacing.


   solution: use `theorempreskipamount′ or update my packages


 武大博士论文 latex 所有文件必须用UTF8格式,可用WinEdit打开好,另存,save as, 格式选

UTF, bib文件也如此:UTF8。否则不能编译。

编译流程:

xelatex -> bibtex -> xelatex -> xelatex

 

用LATEX 排版编程技术书籍的一些个人经验.pdf

2011 beamer

beamer_book_review_template.tex

beamer_my_paper_outline.tex



[4] 脚注

   数学公式、表格中不能直接用footnote{……}, 应该在要添加脚注的地方使用/footnotemark[n]标记,其中n表示脚注的编号;在tabular环境外则用/footnotetext[n]{……}填入脚注内容,注意这里的[n]应该与表格中的/footnotemark中的[n]一一对应。
示例:
begin{tabular}{|c|c|c|}
hline
类型名称&占用空间&表示范围//
hline
real&6字节/footnotemark[3]&$2.9 /times 10^{-39} /sim 1.7 /times 10^{38}$//
hline
single&4字节&$1.5 /times 10^{-45} /sim 3.4 /times 10^{38}$//
hline
double&8字节&$5.0 /times 10^{-324} /sim 1.7 /times 10^{308}$//
hline
extended&10字节&$3.4 /times 10^{-4932} /sim 1.1 /times 10^{4932}$//
hline
end{tabular}
footnotetext[3]{在~Free Pascal~中,real~类型可以自动转换成~single~或~double~类型,所以占用的空间大小也不固定。}


[2] JabRef and EndNote
 latex文献:
 1) EndNote tool:  ENDNOTE官方网下载相关工具
     BibTex conversion tools: bibtex_export.ens,放在ENDNOTE目录styles目录下
 2) JabRef
    索引网站 Mendeley, CiteUlike
    JabRef.doc
 
Question:
 -- JabRef中文显示小方块的解决 :
 The trick is as follows:
   -- first set Options||Preferences||General>>Default Encoding as UTF8
   -- then set Options||Preferences||Appearance>>Set table font as simsun (or any other Chinese fonts)
   -- Entry Preview: 改为<font face="simsun">
 -- bib文件合并
   如果两个bib文件,大多数条目相同,但只有少量的不同,可先打开其中一个,然后File-Append database,
选择另一个文件,然后Tools-Scan database - Find and remove exact duplicates即可。
 -- bibtex key: [auth]-[year]-p[firstpage]-[lastpage]
bibtex中文参考文献使用:
       latex文件加入:bibliographystyle{GBT7714-2005NLang}
               bibtex 用GBK  
           
           
EndNote:    
文献检索是读博入门基本功,博士阶段时间短,任务要求高。必须一边读文章一边补基础,两者交替执行。光是读文章,而缺乏必要的基础,研究工作如同空中楼阁;反之,补基础则可能失去方向感,或耗时过长,难以坚持。如何阅读文章,可以参考施一公《学生如何提高专业英文阅读能力》和《如何提高英文的科研写作能力》。EndNote使用可参考中科大罗昭锋的资料和刘卓燕的
   
3  InkScape
 输入公式: TexText:  http://pav.iki.fi/software/textext/
   suit_package:  site-packages.zip  
   pstoedit:  pstoeditsetup_win32.exe
     Q:  pstoedit 没有CORE_RL_Magick++.dll ?
     A:  删除 pstoeditdrvmagic.dll  文件
4  WORD & Visio:
Aurora公式编辑器: lets you use LaTeX in Microsoft®Word, PowerPoint®, Visio®, Excel®,
and many other programs
       Aurora.rar
   Bibtex4Word:  JabRef --> Word
   Q:  bittex4word.dot  --> word启动文件夹
   A: 启动文件夹是  隐藏文件夹 --> Control Panel
       水寿松: 利用Bibtex4Word实现Word写作时参考文献的插入和排版
 Word 题注与交叉引用  可参考:http://blog.csdn.net/hunauchenym/article/details/5915616
     2013 version: bibtex4word.zip
[2-] Visio
visio中怎样制作大括号图形?
5 Version Control
版本控制:
 SVN:
 Git:Linux
 VisualSVN server:  Free but no opern source
 VisualSVN server + TortoiseSVN (GUI/CUI) http://tortoisesvn.net/
 Win7 64bit VisualSVN server 安装报错:WMI Schema
       http://www.visualsvn.com/support/topic/00059/  

上面说,在有NVIDIA独立显卡的笔记本上运行VisualSVN可能会遇到一下两种错误:

安装或更新VisualSVN时报错:

Custom action InstallWMISchemaExcute failed: Cannot query proxy blanket: No such interface supported (0x80004002).

在VisualSVN Server Manager面板上看到错误:

Cannot query proxy blanket: no such interface supported (0x80004002)    

一看这症状,跟我遇到的一模一样,再看解决方案:解决方案大意是说,这个错误只会在有NVIDIA独立显卡的笔记本上出现,只要切换到集成显卡即可,下面还给出了具体步骤:

1.打开NVIDIA控制面板.

2.选择3D设置->管理3D设置.

3.选择集成显卡作为优先的图形处理器.

4.点击应用.

照做了一遍,果然有用...



改装 Mercurial: 轻量级分布式版本控制系统,采用Python语言实现,易于学习和使用      
  TortoiseHg
[6] Beamer   and PDFscreen
Beamer 中加目录:(2011.8.17)
- 问题:若仅用section{},一切OK。但若用了part{}, 就出问题了,在table of contents 显示部分标题,如其中Part I
- 方法:
            begin{frame}
            tableofcontents
            tableofcontents[pausesections,part=1]
            tableofcontents[pausesections,part=2]
            tableofcontents[pausesections,part=3]
            end{frame}
beamer 用于做PPT  
- WebSite:  Beamer Quickstart:  http://www.math.umbc.edu/~rouben/beamer/
beamer范例一
beamer 加水印示例water_marke.tex
 
- beamer 公式演示动画:  beamer-arrows.tex   beamer-arrows.pdf
- Beamer中文书签乱码的解决方法:
 latex->dvips->ps2pdf 的流程来解决。首先,改变 beamer 中默认的 hyperref 设置,如下:
           documentclass[cjk,hyperref={dvips}]{beamer}
   可以生成带书签的ps,然后执行命令过程如下:
       latex
       latex
       dvips
       ps2pdf
我的经验:无需加入hyperref={dvips}, 直接documentclass[cjk]{beamer}即可
beamer :
           tableofcontents[
               currentsubsection,
               hideothersubsections,
               sectionstyle
=show/hide,
               subsectionstyle
=show/shaded,
           
]
usepackage{multicol}
AtBeginSection[] {
 begin{frame}<beamer>transsplitverticalin
   %frametitle{Outline}
   begin{multicols}{2}
   tableofcontents[currentsection,currentsubsection]
   end{multicols}
 end{frame}
}
AtBeginSubsection[] {
 begin{frame}<beamer>transsplitverticalin
   %frametitle{Outline}
   begin{multicols}{2}
   tableofcontents[currentsection,currentsubsection]
   end{multicols}
 end{frame}
}
begin{frame}transsplitverticalin
begin{multicols}{2}
tableofcontents
end{multicols}
end{frame}
Beamer 加入时钟:

beamer-clock.pdf

beamer-clock.tex

[ii] 本一直用beamer做PPT,老板看了总说看不懂PPT逻辑层次,我就试着在beamer上加各章节自动编号,但是不随人愿,beamer不能加,就看看PDFscreen,虽然模板少了些,但有特色。
pdfscreen可以实现同一个tex文件,编译出A4纸的普通文档和投影文件。只需要在调用包的时候使用不同的参数。如下:
   产生普通文档使用usepackage[print]{pdfscreen}
   产生投影文档使用usepackage[screen]{pdfscreen}

object Z 的latex文件:



       
[7] Origin:
 对数坐标 -> scale -> type: lg10


[8] 突然发现论文字体


**Question**: Latex中,将Listing嵌入figure中


***

7 Latex 个人简历模板

不善于Word排版,就试试latex -> ModernCV



Professional CV.zip

moderncv.zip




https://blog.sciencenet.cn/blog-468147-353705.html

上一篇:学术检索
下一篇:《语义网基础教程》(A Semantic Web Primer) 读后感
收藏 IP: 106.6.172.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-7 02:59

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部