Jackey's 感悟

Do Research

Category Archives: research

将文件夹下所有的形如*authoryear*的论文重命名为year-*authoryear*格式

论文多了,需要有良好的分类和目录结构,才有利于在知识上挖掘出更新的知识。

一直以来都是使用[author][year]这种方式命名论文文件,这个的好处是同一作者、同一 领域的论文能够 自动地按照author进行展示,不足的是要对整个领域的某一子领域进行分析不是非常方便,因此需要有方便的 文献管理工具,这里推荐jabref,因为使用它,你不必担负盗版的名声,同时,它也非常好用。

在文献管理工具中可以通过自动的排序(例如jabref中能够按照author、year的方式排序),也可以自己调整排序方式,很是 方便。按道理,有了文献管理工具,就不需要在文件夹中去翻来覆去地挑拣文献了,但是为了好看,我突然觉得[year]-[author] [year]的方式非常有趣。那么我们可以在jabref中的bibkey设置为[author][year]模式, 而在文件夹中设置成[year]-[author][year]模式,这可以在文献管理工具和论文写作上,同时在文件夹浏 览中取得 比较好的视觉效果折衷。

那么问题就是如何将上万个文件重命名,这肯定不能用F2+typing去做,会死人的,至少脑子会笨死的。 于是coding如下,最优先使用的当然是脚本语言了。于是最常用的shell脚本出炉一个(仍有一些bug存在)。

#! /bin/bash 
# rename files 
#  see gist https://gist.github.com/3188132
# TODO 
# 1. filename with more than one year number 
# a file name with more than one year number, like 
# Chen2000-tech-Guanling-Chen-TR2000-381, the shell doesn't # know how to deal with it, as the result of grep "-Po" returned 
# with two number "2000\n" and "2000" 
# 
# 2. filename with spaces 
# 3. same filename conflict

for filename in `find . -type f -and -name "*.nh" -or -name "*.kdh" -or -name "*.pdf" -or -name "*.ps" -or -name "*.ppt"` do
    echo "filename is $filename" 
    if [ -f "$filename" ]
    then
           dname=`dirname "$filename"` 
fname=`basename "$filename"` 
year=`echo "$fname" | grep -Po "^(19|20)\d{2}"` 
if [ $year ] 
then echo "begin with year number, ignored" continue fi year=`echo "$fname" | grep -Po "(19|20)\d{2}"` if [ $year ] then newname="$dname"/$year-"$fname" echo "new name is $newname" mv "$filename" "$newname" fi fi done

Bibliography Entry Types for .bib file

Bibliography Entry Types for .bib file

Entry types

When entering a reference in the bibliography database, the first thing to decide is what type of entry it is. No fixed classification scheme can be complete, but BibTeX provides enough entry types to handle almost any reference reasonably well.

References to different types of publications contain different information; a reference to a journal might include the volume and number of the journal, which is usually not meaningful for a book. Therefore, database entries of different types have different fields for each entry type, the fields are divided into three classes:

Required
omitting the field will produce an error message and may result in a badly formatted bibliography entry. If the required information is not meaningful, you are using the wrong entry type.
Optional
the field’s information will be used if present, but can be omitted without causing any formatting problems. A reference should contain any available information that might help the reader, so you should include the optional field if it is applicable.
Ignored
the field is ignored. BibTeX ignores any field that is not required or optional, so you can include any fields you want in a bibliography entry. It’s often a good idea to put all relevant information about a reference in its bibliography entry – even information that may never appear in the bibliography. For example, if you want to keep an abstract of a paper in a computer file, put it in an ‘abstract’ field in the paper’s bibliography entry. The bibliography database file is likely to be as good a place as any for the abstract, and it is possible to design a bibliography style for printing selected abstracts.

BibTeX ignores the case of letters in the entry type.

Subtopics

article entry

An article from a journal or magazine.

Format:

     @ARTICLE{citation_key,
              required_fields [, optional_fields] }

Required fields: author, title, journal, year

Optional fields: volume, number, pages, month, note, key

book entry

A book with an explicit publisher.

Format:

     @BOOK{citation_key,
           required_fields [, optional_fields] }

Required fields: author or editor, title, publisher, year

Optional fields: volume, series, address, edition, month, note, key

booklet entry

A work that is printed and bound, but without a named publisher or sponsoring institution.

Format:

     @BOOKLET{citation_key,
              required_fields [, optional_fields] }

Required fields: title

Optional fields: author, howpublished, address, month, year, note, key

conference entry

An article in the proceedings of a conference. This entry is identical to the ‘inproceedings’ entry and is included for compatibility with another text formatting system.

Format:

     @CONFERENCE{citation_key,
                 required_fields [, optional_fields] }

Required fields: author, title, booktitle, year

Optional fields: editor, pages, organization, publisher, address, month, note, key

inbook entry

A part of a book, which may be a chapter and/or a range of pages.

Format:

     @INBOOK{citation_key,
             required_fields [, optional_fields] }

Required fields: author or editor, title, chapter and/or pages, publisher, year

Optional fields: volume, series, address, edition, month, note, key

incollection entry

A part of a book with its own title.

Format:

     @INCOLLECTION{citation_key,
                   required_fields [, optional_fields] }

Required fields: author, title, booktitle, year

Optional fields: editor, pages, organization, publisher, address, month, note, key

inproceedings entry

An article in the proceedings of a conference.

Format:

     @INPROCEEDINGS{citation_key,
                    required_fields [, optional_fields] }

Required fields: author, title, booktitle, year

Optional fields: editor, pages, organization, publisher, address, month, note, key

manual entry

Technical documentation.

Format:

     @MANUAL{citation_key,
             required_fields [, optional_fields] }

Required fields: title

Optional fields: author, organization, address, edition, month, year, note, key

mastersthesis entry

A Master’s thesis.

Format:

     @MASTERSTHESIS{citation_key,
                    required_fields [, optional_fields] }

Required fields: author, title, school, year

Optional fields: address, month, note, key

misc entry

Use this type when nothing else seems appropriate.

Format:

     @MISC{citation_key,
           required_fields [, optional_fields] }

Required fields: none

Optional fields: author, title, howpublished, month, year, note, key

phdthesis entry

A PhD thesis.

Format:

     @PHDTHESIS{citation_key,
                required_fields [, optional_fields] }

Required fields: author, title, school, year

Optional fields: address, month, note, key

proceedings entry

The proceedings of a conference.

Format:

     @PROCEEDINGS{citation_key,
                  required_fields [, optional_fields] }

Required fields: title, year

Optional fields: editor, publisher, organization, address, month, note, key

techreport entry

A report published by a school or other institution, usually numbered within a series.

Format:

     @TECHREPORT{citation_key,
                 required_fields [, optional_fields] }

Required fields: author, title, institution, year

Optional fields: type, number, address, month, note, key

unpublished entry

A document with an author and title, but not formally published.

Format:

     @UNPUBLISHED{citation_key,
                  required_fields [, optional_fields] }

Required fields: author, title, note

Optional fields: month, year, key

Del.icio.us : , ,
Flickr : , ,