diff options
Diffstat (limited to 'support/copac-clean')
-rw-r--r-- | support/copac-clean/README | 7 | ||||
-rw-r--r-- | support/copac-clean/copac-clean-lib.inc | 229 | ||||
-rw-r--r-- | support/copac-clean/copac-clean.desktop | 9 | ||||
-rw-r--r-- | support/copac-clean/copac-clean.pdf | bin | 0 -> 531897 bytes | |||
-rwxr-xr-x | support/copac-clean/copac-clean.sh | 21 | ||||
-rw-r--r-- | support/copac-clean/copac-clean.sno | 179 | ||||
-rw-r--r-- | support/copac-clean/copac-clean.tex | 339 |
7 files changed, 784 insertions, 0 deletions
diff --git a/support/copac-clean/README b/support/copac-clean/README new file mode 100644 index 0000000000..377ef9cb69 --- /dev/null +++ b/support/copac-clean/README @@ -0,0 +1,7 @@ +COPAC-CLEAN. Automatic editing of Copac/BibTeX records. +Version 0.8 28.08.2015 + +This standalone utility edits the Copac/BibTeX records, improving some details (punctuation, name of some fields) and adding some useful new fields. The programme is written using Snobol for editing, zenity for a simple GUI and a bash script as framework. This utility runs only on Linux but a Windows porting is planned. + +Copyright (C) 2015 Guido Milanese <guido.milanese@unicatt.it> +This material is subject to the LaTeX Project Public License. Please read the manual for information about license. diff --git a/support/copac-clean/copac-clean-lib.inc b/support/copac-clean/copac-clean-lib.inc new file mode 100644 index 0000000000..edf2fcc9f1 --- /dev/null +++ b/support/copac-clean/copac-clean-lib.inc @@ -0,0 +1,229 @@ +*COPAC-CLEAN-LIB. Library files for COPAC-CLEAN. +*Version 0.8 28.08.2015 +*Copyright (C) Guido Milanese <guido.milanese@unicatt.it> +* +* License: LaTeX Project Public License 1.3c +* +* Library files for copac-clean.sno +* (C) Guido Milanese 2015 +* guido.milanese@unicatt.it +* Sources: +* bq.sno: +* PHIL BUDNE <phil@ultimate.com> +* compiler +* GREGORY WHITE <glwhite@netconnect.com.au> +* other functions +* GUIDO MILANESE <guido.milanese@unicatt.it> +* include files statements are commented to avoid double loading + +* $Id: bq.sno,v 1.4 1997/09/14 04:36:57 phil Exp $ +* execute a shell command line and capture stdout +* +* like shell backquotes (hence the name) +* p budne, june 20, 1994 + +* optional second arg is string to use to seperate lines + + DEFINE("BQ(COMMAND,OFS)UNIT") :(END_BQ) +BQ UNIT = IO_FINDUNIT() :F(FRETURN) + INPUT(.X,UNIT,,'|' COMMAND) :F(FRETURN) + OFS = IDENT(OFS) ' ' + BQ = X :F(BQF) +BQL BQ = BQ OFS X :S(BQL) + ENDFILE(UNIT) + DETACH(.X) :(RETURN) +BQF ENDFILE(UNIT) + DETACH(.X) :(FRETURN) +END_BQ + + +*-- Function ITRIM +*-- "Initial trim" +*-- guido.milanese@unicatt.it +*-- ven set 9 2005 + define("itrim(Pass)") :(itrim_end) +itrim +itrim_bg Pass ? pos(0) ' ' = :s(itrim_bg) +itrim_rt itrim = pass :(return) +itrim_end + +* ACC.INC +* GM 2003 +* <guido.milanese@mclink.it> +* Accents etc. according to different languages +* The returned string must be parsed by the calling program +* Up to '-' : lowercase accents +* After '-' : uppercase accents +* Options: +* es = Spanish +* de = German +* fr = French +* it = Italian +* XX = all accents of table 8859-XX (e.g. 8859-15) +* en = no accents (English) + + DEFINE("acc(option)") + digits = '1234567890' +* German + acc_de1 = "äëïöüß" ; acc_de2 = "ÄËÏÖÜß" ; acc_de = acc_de1 '-' acc_de2 +* Spanish + acc_es1 = "áéíóúñ" ; acc_es2 = "ÁÉÍÓÚÑ" ; acc_es = acc_es1 '-' acc_es2 +* French + acc_fr1 = "áàèéíìóòúùâêîôûäëïöüç" + acc_fr2 = "ÁÀÈÉÍÌÓÒÚÙÂÊÎÔÛÄËÏÖÜÇ" + acc_fr = acc_fr1 '-' acc_fr2 +* Italian + acc_it1 = "áàèéíìóòúùâêîôû" + acc_it2 = "ÁÀÈÉÍÌÓÒÚÙÂÊÎÔÛ" + acc_it = acc_it1 '-' acc_it2 +* All + acc_001 = acc_de1 acc_es1 acc_fr1 acc_it1 + acc_002 = acc_de2 acc_es2 acc_fr2 acc_it2 + acc_00 = acc_001 '-' acc_002 + +* Complete table (e.g. 8859-15): builds string of chars + k = 127 + chars8859 = '' +ACC_DO ( ++ (lt(k,255)) ++ (k = k + 1) ++ (chars8859 = chars8859 char(k)) ++ ) :s(ACC_DO) + + :(ACC_END) + +ACC +* Trims spaces at begin and end of option +ACC_N option ? ' ' = :s(ACC_N) +* If no option given, sets to all accents (option '00') +** ( ~(option ? any(&lcase digits)) (option = '00') ) +* If a number is passed as option, means a complete table (e.g. 8859-1) +** ( (option ? any(digits)) (option = 'TA') ) + ( ++ (~(option ? any(&lcase digits)) (option = '00')), ++ ( (option ? any(digits)) (option = 'TA') ), ++ (option = option) ++ ) + +* Checks option + ( ++ ~(option ? ("en" | "es" | "de" | "fr" | "it" | "TA" | "00")) ++ (terminal = 'Please supply a valid language identifier') ++ ) :s(freturn) + :($('ACC_' option)) + +ACC_ES acc = acc_es :(return) +ACC_DE acc = acc_de :(return) +ACC_FR acc = acc_fr :(return) +ACC_IT acc = acc_it :(return) +ACC_EN acc = '' '-' '' :(return) +ACC_TA acc = chars8859 '-' ' ' :(return) +ACC_00 acc = acc_00 :(return) +ACC_ terminal = "Please supply a valid language identifier" :(freturn) +ACC_END + +*-- Function MAMI +*-- Uppers to Lowers including accented chars +*-- guido.milanese@unicatt.it +*-- 2007 + define("mami(pass)") +*-include "acc.inc" + lang = "XX" + (acc(lang) ? break('-') . acc_mi len(1) rem . acc_ma ) + acc_mm = acc_ma acc_mi ;* tutti i car. accentati + ch_ma = &ucase acc_ma ;* caratteri maiuscoli ridefiniti + ch_mi = &lcase acc_mi ;* caratteri minuscoli ridefiniti + chars = ch_ma ch_mi ;* caratteri + :(mami_end) +mami Pass = replace(Pass,ch_ma,ch_mi) +mami_rt mami = Pass :(return) +mami_end + + +* Compiler.inc +* Gregory White <glwhite@netconnect.com.au> +* Posted to the Snobol list (March 2003) +* and adapted as a function + DEFINE('COMPILER()') :(COMPILER_END) +compiler +IDprocessor :($('COMPILER' SIZE(DATE()))) +COMPILER17 compiler = 'SPITBOL' :(return) +COMPILER19 compiler = 'CSNOBOL4' :(return) +COMPILER20 compiler = 'SNOBOL4+' :(return) +compiler_end +* Uses the different size of DATE() to detect the compiler used + + +* SYSTYPE +* Sets new_line value according to OS +* Guido Milanese <guido.milanese@unicatt.it> +* March 2003 + DEFINE('SYSTYPE()os') :(SYSTYPE_END) +SYSTYPE os = replace(host(),&UCASE,&LCASE) +UNIX os ? ('nix' | 'nux') :f(DOS) + systype = char(10) :(return) +DOS systype = char(13) char(10) :s(return) +SYSTYPE_END +* 'os' is the string returned by host(). +* The function does not work under snobol4+, requires Spitbol or CSnobol4. + +* NEWLINE +* Checks OS and compiler type to set newline +* Part of this function uses a function posted by +* Gregory White <glwhite@netconnect.com.au> +* on the Snobol list in March 2003 +* Guido Milanese <guido.milanese@unicatt.it> + define('newline()compiler_type') +*-include "compiler.inc" +*-include "systype.inc" + :(newline_end) +newline +* Compiler being used. If it is Snobol4+, that does not have +* the HOST() function, assumes that the newline is Dos type +snobol4 (compiler_type = compiler()) ? "SNOBOL4+" :f(other) + newline = char(13) char(10) :(return) +* otherwise finds through HOST the OS type and sets newline +* accordingly +other newline = systype() :(return) +newline_end + +****************************************** +* NOPAIRS +* Removes pairs +****************************************** +* Guido Milanese 2004 +* <guido.milanese@unicatt.it> +* Changes pairs in given string: all sequences of 2 given chars are changed to 1 +* If second argument is not given, assumes to remove spaces +* Examples: +* String = nopairs(String,'-') ;* changes any sequence of 2 hyphens to 1 hyphen in String +* String = nopairs(String) ;* changes any sequence of 2 spaces to 1 space in String + define('nopairs(String,Char)') :(nopairs_end) +nopairs + ( ~(String ? Char) (terminal = "'" Char "' not found in '" String "'") ) :s(freturn) + ( (lt(size(Char),1) ) (Char = ' ') ) +nopairs_loop String ? (Char Char) = Char :s(nopairs_loop) +nopairs_return nopairs = String :(return) +nopairs_end + + +* REPL.inc - REPL(S1,S2,S3) will do a string-by-string replacement +* (as opposed to a character-by-character replacement +* ala REPLACE) on the string S1. The string S1 is scanned +* for instances of the string S2 and each is replaced by +* S3. Portions of S1 already scanned and the replaced +* string are not reexamined for instances of S2. +* +*-INCLUDE "breakx.inc" + DEFINE('REPL(S1,S2,S3)C,T,FINDC') :(REPL_END) +REPL S2 LEN(1) . C = :F(FRETURN) + FINDC = BREAK(C) . T LEN(1) + S2 = POS(0) S2 +REPL_1 S1 FINDC = :F(REPL_2) + S1 S2 = :F(REPL_3) + REPL = REPL T S3 :(REPL_1) +REPL_3 REPL = REPL T C :(REPL_1) +REPL_2 REPL = REPL S1 :(RETURN) +REPL_END + + diff --git a/support/copac-clean/copac-clean.desktop b/support/copac-clean/copac-clean.desktop new file mode 100644 index 0000000000..e38e7b5023 --- /dev/null +++ b/support/copac-clean/copac-clean.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=copac-clean +Comment=Cleans Copac BibTeX +Exec=copac-clean.sh +Icon=text-x-bibtex-icon +Terminal=false +StartupNotify=false diff --git a/support/copac-clean/copac-clean.pdf b/support/copac-clean/copac-clean.pdf Binary files differnew file mode 100644 index 0000000000..88a34ab1c3 --- /dev/null +++ b/support/copac-clean/copac-clean.pdf diff --git a/support/copac-clean/copac-clean.sh b/support/copac-clean/copac-clean.sh new file mode 100755 index 0000000000..aa31f7011a --- /dev/null +++ b/support/copac-clean/copac-clean.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# copac-clean.sh +# version 0.8 +# 28.08.2015 +# Copyright (C) Guido Milanese guido.milanese@unicatt.it +# requires copac-clean.sno +# requires xclip: xclip copies to the clipboard +# checks if xclip and snobol4 are installed + if ! type xclip > /dev/null 2>&1; then + echo "xclip is not installed. Exiting."; + exit; + elif ! type snobol4 > /dev/null 2>&1; then + echo "snobol4 is not installed. Exiting."; + exit; + fi + rm -f copactmpfile # if the case + CCDIR=$(dirname $(which copac-clean.sh)) + cd $CCDIR # important for desktop launcher! + snobol4 -b $CCDIR/copac-clean.sno >copactmpfile + cat copactmpfile | xclip -selection c -i + rm -f copactmpfile diff --git a/support/copac-clean/copac-clean.sno b/support/copac-clean/copac-clean.sno new file mode 100644 index 0000000000..fa97342dfd --- /dev/null +++ b/support/copac-clean/copac-clean.sno @@ -0,0 +1,179 @@ +* COPAC-CLEAN.SNO +* Edits library cards from COPAC removing BibTeX errors +* version 0.7 29.08.2015 +* guido.milanese@unicatt.it +* requires xclip and zenity +* called from copac-clean.sh +* +* ---> Set tabstop=3 to read/edit this file +* +* LIBRARY FILES +-include "bq.sno" ;* shell operations +-include "itrim.inc" ;* initial trim +-include "mami.inc" ;* converts uppercase to lowercase +-include "newline.inc" ;* sets newline according to OS +-include "nopairs.inc" ;* nopairs (' ' = ' ') +-include "repl.inc" ;* string-by-string replacement + +************************* +* INITIALISATIONS +************************* +* Copacbib is the BibTeX item produced by COPAC, now empty + Copacbib = + nl = newline() ;* sets newline according to OS + ErrMsg0 = "\t\t<b>No selection!</b>\n" ++ "Check again the Copac page and your selection\n\n" ++ "\t\t\tExiting" + ErrMsg1 = "\t\t<b>No valid BibTeX file!</b>\n" ++ "Check again the Copac page and your selection\n\n" ++ "\t\t\tExiting" +* Pattern: hyphenation. Admits 2 forms, old (wrong) and new + P_hyphen = (("language = {") | ("langage = {")) ++ (("English" | "French" | "German" | "Italian" | "Latin") . Language) '}' +* Pattern: entrytype + P_entrytype = '@' (arb . V_entrytype) '{' +* Pattern: author. Accepts space/no space + P_author = "author" . Label_author ++ (span(' ') | '') '=' (span(' ') | '') '{' (arb . Name_author) "}," +* Pattern: note, as above + P_note = ((nl | ' ') "note" . Label_note) ++ (span(' ') | '') '=' (span(' ') | '') arb "}," +* Pattern: title, as above + P_title = "title" (span(' ') | '') '=' (span(' ') | '') arb "}," +* Pattern: label + P_label = '@' break('{') len(1) (arb . V_label) "," + +************************* +* INTERNAL FUNCTIONS +************************* + +************************************** +*-- Function READANDCHECK +*-- Reads from clipbpoard, checks if it is all right +************************************** +*-- requires itrim.inc + define("readandcheck()Par1,Par2") :(readandcheck_end) +readandcheck +readandcheck_bg +* first check zenity: +* if zenity does not work exits + Zchk = bq('zenity --version') + (leq(Zchk)) (Terminal = "Zenity is not installed") :s(end) +* +* now read/check the COPAC item +* Copacbib is the BibTeX item produced by COPAC +* reads from the clipboard, if fails exits + Copacbib = bq("xclip -o") ;*:f(freturn) + leq(Copacbib) :f(readancheck_goon) + (bq('zenity --error --no-wrap --text="' ErrMsg0 '"')) :(end) +* checks if it is a valid BibTeX item: +* if Copacbib does not begin with a '@' fails and exits +* First removes any blank at the beginning +readancheck_goon + Copacbib = itrim(Copacbib) + Copacbib ? pos(0) '@' :s(readandcheck_rt) + bq('zenity --error --no-wrap --text="' ErrMsg1 '"') :(end) + +readandcheck_rt readandcheck = Copacbib :(return) +readandcheck_end + +************************************** +*-- Function CPCTR +*-- Transformation of COPAC data +************************************** + define("cpctr(Copacdata)Par1,Par2") :(cpctr_end) +cpctr +cpctr_bg +* common errors in the AUTHOR field + Copacdata ? P_author + Name_author2 = Name_author +authors1 Name_author2 ? ", and" = " and" :s(authors1) +authors2 Name_author2 ? ". and" = " and" :s(authors2) ;* 28.12.2013 + Copacdata ? Name_author = Name_author2 +* +* if entrytype is proceedings changes "author" to "editor" +* entrytype? + Copacdata ? P_entrytype +* Copacdata ? P_author + ( ++ (V_entrytype ? "proceedings") ++ (Copacdata ? Label_author = "editor") ++ ) +* +* adds always a SHORTTITLE field. +* The SHORTTITLE is to be later edited manually, according to the +* user's preferences. +* Adds a BOOKTITLE field only if entrytype is PROCEEDINGS +* Useless for BIBLATEX but necessary for standard BIBTEX +* title + Copacdata ? P_title . V_title + Shorttitle = " short" V_title + Booktitle = " book" V_title ;* leave it here! + Copacdata ? V_title = V_title Shorttitle + ((V_entrytype ? "proceedings") (Copacdata ? V_title = V_title Booktitle)) +* +* Hyphenation. Works only if ONE language is declared + Copacdata ? P_hyphen . V_hyphen + V_hyphen2 = V_hyphen + V_hyphen2 ? "langage" = "hyphenation" ;* try also the wrong form, no harm +* V_hyphen2 ? "language" = "hyphenation" ;* corrected by COPAC, at last! + V_hyphen2 ? "language" = "langid" ;* changed 0.8 28.08.2015 + Language2 = mami(Language) + Language2 ? "english" = "british" ;* optional + Language2 ? "latin" = "italian" + V_hyphen2 ? Language = Language2 + Copacdata ? V_hyphen = V_hyphen2 +* +* Location. Changes to 'll' (optional) + Copacdata ? "location " = "ll " +* +* Changes NOTE fields to ANNOTE: the NOTE field is normally printed, +* while the NOTE field produced by Copac is normally an annotation +* loops because there are frequently more than 1 NOTE fields +cpctrlpn Copacdata ? P_note . V_note :f(cpctrlpn_nd) + V_note2 = V_note + V_note2 ? "note" = "annote" + Copacdata ? V_note = V_note2 :(cpctrlpn) +cpctrlpn_nd +* +* Punctuation cleanup +punct1 Copacdata ? " : }" = "}" :s(punct1) +punct2 Copacdata ? (any(",.:; ") '}') . W = "}" :s(punct2) +punct3 Copacdata ? "title=" = "title = " :s(punct3) + Copacdata = nopairs(Copacdata) +newlines Copacdata = repl(Copacdata,"},", "}," nl) + Copacdata = repl(Copacdata, ", author", ',' nl "author") + Copacdata = repl(Copacdata, ", editor", ',' nl "editor") + Copacdata = repl(Copacdata," :",':') + Copacdata ? P_label + Output = Copacdata + OkMsg1 = "BibTeX entry <b>" V_label "</b> transformed.\n" ++ "Now paste the clipboard contents to your BibTeX archive\n\n" ++ "\t\t\t Exiting" + bq('zenity --info --no-wrap --title="Done!" --text="' OkMsg1 '"') +cpctr_rt cpctr = Copacdata :s(return)f(freturn) +cpctr_end + + +****************************** +* MAIN PROGRAMME +****************************** +* Reads from clipboard and checks data + Copacbib = readandcheck() :f(end) +* Transforms data + ( ++ ~(Copacbib = Cpctr(Copacbib)) ++ (Terminal = "Something wrong!") ++ ) +end +* +****************************** +* HISTORY +****************************** +10.09.2013 version 0.1 +15.09.2013 version 0.2 -- first usable +30.10.2013 version 0.3 -- some fields corrected; comments edited +27.12.2013 version 0.4 -- changes author to editor in proceedings +28.12.2013 version 0.5 -- general editing of functions +05.01.2014 version 0.6 -- improved check + diff --git a/support/copac-clean/copac-clean.tex b/support/copac-clean/copac-clean.tex new file mode 100644 index 0000000000..0a94952f51 --- /dev/null +++ b/support/copac-clean/copac-clean.tex @@ -0,0 +1,339 @@ +% Documentation for copac-clean +% Guido Milanese - guido.milanese@unicatt.it +% Version 0.8 +% +\documentclass[a4paper,11pt,english]{article} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{url} +\renewcommand{\UrlFont}{\footnotesize\tt} +\usepackage{babel} +\usepackage{graphicx} +\usepackage{libertine} +\begin{document} +\title{The copac-clean utility\\ +Version 0.8} +\author{Guido Milanese <\url{guido.milanese@unicatt.it}>} +\date{28th August 2015} +\maketitle +\thispagestyle{empty} +% +\begin{abstract} +\noindent{}This standalone utility edits the Copac/BibTeX records, +improving some details and adding some useful fields. The programme is +written using Snobol for editing, tck/tk for a simple GUI and a bash +script as framework. The utility is only available for use under Linux, but could easily be ported to Windows. +\end{abstract} +% +\tableofcontents{} +\enlargethispage{3.3mm} +% +\section{Copac-clean: description and features} +Copac (\url{http://copac.ac.uk}) is one of the best resources for +academics, students, librarians: it unifies more the 70 catalogues of +libraries of the UK, featuring around «40 million records in 452 +languages» (Copac information from \url{http://copac.ac.uk/faq/}). Copac +records can be exported in several formats, including BibTeX. However, some +minor details of the Copac/BibTeX format can be improved, and -- particularly for Biblatex users -- some more fields can be easily added. + +\subsection{Editing} +This is a typical COPAC/BibTeX record:\label{exrecord} +\footnotesize% +\begin{verbatim} +@proceedings{Giannantoni:1996, +author = {Giannantoni, Gabriele. and Gigante, Marcello,}, +title= {Epicureismo greco e romano : atti del congresso + internazionale, Napoli, 19-26 maggio 1995}, +series = {Elenchos ; 25 }, +series = {Elenchos (series) ; 25. }, +address = {[Napoli] : }, +publisher = {Bibliopolis,}, +year = {c1996.}, +size = {3 v. (1128 p.) ; 23 cm.}, +language = {English ; French ; German ; Italian}, +isbn = {ISBN: 8870883620}, +note = {Papers from an international congress + held in Naples, 19-26 May 1993.}, +note = {Includes bibliographical references (v. 3, p. [1005]-1056) + and indexes.}, +note = {Italian, English, French and German contributions.}, +keywords = {Epicurus -- Congresses.}, +keywords = {Epicurus -- Influence -- Congresses.}, +keywords = {Philosophy, Ancient -- Congresses.}, +location = {King's College London ; University of London - ULRLS}, +} +\end{verbatim} +\normalsize% +The first problem that any BibTeX user can detect is useless punctuation. +For example: +\footnotesize% +\begin{verbatim} + author = {Giannantoni, Gabriele. and Gigante, Marcello,}, +\end{verbatim} +\normalsize% +should be improved as follows: +\newpage{} +\footnotesize% +\begin{verbatim} + author = {Giannantoni, Gabriele and Gigante, Marcello}, +\end{verbatim} +\normalsize% +The same applies to all the other entries (see e.g. \textsf{year}, +\textsf{address}, etc.). +Improving this inaccurate, useless punctuation is the first purpose of this +utility. + +See now the \textsf{note} field(s): +\footnotesize% +\begin{verbatim} + note = {Papers from an international congress + held in Naples, 19-26 May 1993.}, + note = {Includes bibliographical references (v. 3, p. [1005]-1056) + and indexes.}, +\end{verbatim} +\normalsize% +In most BibTeX / Biblatex styles the contents of \textsf{note} field is +printed (e.g. «Reprint of the edition Oxford, Oxford U.P. 1976»). The +\textsf{note} field is used by Copac for comments (e.g. if the book +offers a bibliography); for this reason the utility changes +\textsf{note} to \textsf{annote}. + +Another change is \textsf{author} if the record type is +\textsf{proceedings} (see the example above). In this case +\textsf{author} is changed to \textsf{editor}. + +\subsection{Hyphenation} +This feature is useful only to Biblatex users. If the field +\textsf{language} features one and only one language, the field is +transformed from \textsf{language} to \textsf{langid}, and the language +name is transformed according to table 2, page 25 of Philipp Lehman's +Biblatex manual, version 3.0, 20.04.2015. If more than one language is +listed, or if the language is not listed in Lehman's table, the field \textsf{language} is left unchanged. +% +\subsection{Location/Address} +Copac/BibTeX records use \textsf{address} for the place of publication and +\textsf{location} for library names. This choice causes problems of +BibTeX/Biblatex compatibility: \textsf{location} is used by Biblatex in +place of the traditional \textsf{address} field, and \textsf{library} is +used for library names. \textsf{Copac-clean} leaves \textsf{address} +unchanged: this gives no problems because BibTeX uses this field normally +and Biblatex interprets it as an alias for \textsf{location}. To avoid +conflicts, \textsf{location} is changed to \textsf{library}, that is +ignored (= not printed), but can be parsed, by BibTeX, and is standard in +Biblatex. See the discussion in +\url{http://tex.stackexchange.com/questions/57720/bibtex-handling-manuscripts}. + +\subsection{New fields} +The Copac/BibTeX format knows only the \textsf{title} fields, but for some +bibliographic styles (e.g. author-title styles, or the traditional ``long'' +citations still common in the humanities), a \textsf{shorttitle} field is +necessary. This utility outputs a \textsf{shorttitle} identical to +\textsf{title}, because each user/journal/publisher may have preferences +difficult to standardise. For BibTeX (not Biblatex) bibliographic styles, a +\textsf{booktitle} field is necessary in the case of proceedings, +\emph{Festschriften}, edited books etc. For this reason, if and only if the +record type is \emph{proceedings} a \textsf{booktitle} field is +automatically added -- needless to say, it is identical to +\textsf{title}% +\footnote{These features may be possibly transformed to options: + \textsf{shorttitle} is useless for author-date styles, and + \textsf{booktitle} is useless for BibTeX users.}% +. + +\subsection{Final result} +After running this utility, the example printed at page \pageref{exrecord} +is transformed as follows: +\footnotesize% +\begin{verbatim} +@proceedings{Giannantoni:1996, + editor = {Giannantoni, Gabriele and Gigante, Marcello}, + title = {Epicureismo greco e romano: atti del congresso + internazionale, Napoli, 19-26 maggio 1995}, + booktitle = {Epicureismo greco e romano: atti del congresso + internazionale, Napoli, 19-26 maggio 1995}, + shorttitle = {Epicureismo greco e romano: atti del congresso + internazionale, Napoli, 19-26 maggio 1995}, + series = {Elenchos ; 25}, + series = {Elenchos (series) ; 25}, + address = {[Napoli]}, + publisher = {Bibliopolis}, + year = {c1996}, + size = {3 v. (1128 p.) ; 23 cm}, + langid = {italian}, + isbn = {ISBN: 8870883620}, + annote = {Papers from an international congress + held in Naples, 19-26 May 1993}, + annote = {Includes bibliographical references + (v. 3, p. [1005]-1056) and indexes}, + annote = {Italian, English, French and German contributions}, + keywords = {Epicurus -- Congresses}, + keywords = {Epicurus -- Influence -- Congresses}, + keywords = {Philosophy, Ancient -- Congresses}, + library = {King's College London ; University of London - ULRLS}} + \end{verbatim} +\normalsize% +% +\section{Installation} +\subsection{Dependencies} +The programme requires \textsf{xclip}, a modern \textsf{Snobol} +interpreter, and the \textsf{zenity} GUI tool. +\subsection{xclip} +\textsf{xclip} can be normally installed from the software manager provided +by Linux standard distributions. It is a tiny and efficient command line +utility that can read from clipboard or output to clipboard. The homepage +is \url{http://sourceforge.net/projects/xclip/}. +% +\subsection{zenity} +\textsf{Zenity} is a GTK+ lightweight tool -- standard in most Linux +distributions -- that outputs message windows, error windows and the like. See \url{https://help.gnome.org/users/zenity/stable/}. +% +\subsection{Snobol} +Snobol is a powerful language, with unparalleled string processing +abilities. It is a niche language, but it is very useful to linguists and +handy for text transformations as in the present case: if interested in +Snobol, refer to Phil Budne's page (\url{http://www.snobol4.org/}). I +strongly recommend to install the recent CSNOBOL4 release 2.0 (January 1, +2015) by Phil Budne. Unfortunately, Snobol is not offered by standard +Linux distributions, but the installation is very easy (the installation +detects if you are on a 32 or 64 bit system): +\begin{enumerate} + \item download + \url{ftp://ftp.ultimate.com/snobol/snobol4-2.0.tar.gz} + \item \footnotesize\texttt{tar zxfv snobol4-2.0}\normalsize + \item \footnotesize\texttt{cd snobol4-2.0}\normalsize + \item \footnotesize\texttt{configure}\normalsize + \item \footnotesize\texttt{make}\normalsize + \item as root (or sudo), run + \footnotesize\texttt{make install}\normalsize + \item test if it's all right typing \footnotesize\texttt{snobol4 + -v}\normalsize{} in a shell. + You should read a message containing the version number. +\end{enumerate} +% +\section{Installing Copac-clean} +Now copy (1) \textsf{copac-clean.sh} (2) \textsf{copac-clean.sno} (3) \textsf{copac-clean-lib.inc} in the same directory: I would recommend \textsf{/home/yourname/bin/copaclean}. This directory must be in the PATH of your system. Type \texttt{echo \$PATH} in a terminal to know the Path of your system. The script \textsf{copac-clean.sh} must be executable: if not, type \texttt{chmod +x copac-clean.sh}. If you do not have writing permissions on that particular folder as normal user, type \texttt{sudo chmod +x copac-clean.sh} and enter your password, or, on some systems, login as root and type the command. +% +\section{Usage}\label{sec:usage} +\begin{enumerate} + \item select \textsf{BibTeX} in the \textsf{Export} drop down menu + (at bottom of the page): see fig.~\ref{maltby01}. + \item select the whole record, and save it to the clipboard + (Ctrl-C is the standard shortcut): see fig.~\ref{maltby02}. +\end{enumerate} +% +\begin{figure}%[!htbp] +\centering{% +\includegraphics[angle=0,scale=.45]{maltby01} +\caption{Selecting BibTeX export from Copac}\label{maltby01}% +}% +\end{figure} +% +% +\begin{figure}%[!htbp] +\centering{% +\includegraphics[angle=0,scale=.45]{maltby02} +\caption{A BibTeX record from Copac}\label{maltby02}% +}% +\end{figure} +% +% +In Ubuntu systems, use \textsf{Alt-F2}: see fig. \ref{runprogram}. Better, copy the provided \textsf{copac-clean.desktop} file to your desktop: the programme should run without any further adaptation. + +If you prefer, open a terminal and type +% +\begin{verbatim} +copac-clean.sh +\end{verbatim} +% +\emph{The Copac record must be in your clipboard}! To be sure of this, a clipboard utility as \textsf{glipper}, that controls your clipboard selections, can be useful. If the clipboard is empty or does not hold a copy of the Copac-BibTeX record, you'll get an error message (see fig. \ref{errormessage}.) + +If everything goes fine, you'll get a message confirming that the record has been edited (see fig. \ref{okmessage}). +% +\begin{figure}%[!htbp] +\centering{% +\includegraphics[angle=0,scale=.45]{runprogram} +\caption{Running Copac-clean}\label{runprogram}% +}% +\end{figure} +% +\begin{figure}%[!htbp] +\centering{% +\includegraphics[angle=0,scale=.45]{errormessage} +\caption{Error message: wrong clipboard contents}\label{errormessage}% +}% +\end{figure} +% +% +\begin{figure}%[!htbp] +\centering{% +\includegraphics[angle=0,scale=.45]{okmessage} +\caption{End of transformation}\label{okmessage}% +}% +\end{figure} +% + +\subsection{Paste the new version}\label{sec:paste} +Now your clipboard is used by the transformed BibTeX record, not by the old +version (you can check it with \textsf{glipper} or similar utilities). +Paste the new, transformed record in your BibTeX file or in a +\textsf{Jabref} window% +\footnote{% +Documentation on Jabref: \url{http://jabref.sourceforge.net/}.% +}. +If you use Jabref, click on the name of the database you want to use, and paste the clipboard contents with a simple \texttt{Ctrl-V} or through the \textsf{Modify -- Copy} menu entry. + +\section{Bugs and TODO} +List of features that I would like to add: +\begin{enumerate} +\item A Windows version, if requested by users. +\item Choice among Spitbol and Snobol. +\item More flexibility, e.g. \textsf{shorttitle yes/no} and + \textsf{booktitle yes/no}. +\end{enumerate} + +\section{Acknowledgements} +My warmest thanks to \textsc{Phil Budne} (\url{phil@ultimate.com}) for +making his excellent CSNOBOL available and for his generous help. Many +thanks to the community of Snobol users, and to \textsc{Rafal M. Sulejman} +(\url{http://rms.republika.pl/}) whose \textsf{vim} syntax files are a +daily blessing. +% +\section{History} +\begin{tabular}{l l p{8cm}} +10.09.2013 & version 0.1 & \\ +15.09.2013 & version 0.2 & first usable\\ +30.10.2013 & version 0.3 & some fields corrected; comments +edited\\ +27.12.2013 & version 0.4 & changed author to editor in +proceedings\\ +28.12.2013 & version 0.5 & general editing of functions\\ +07.01.2014 & version 0.6 & improved check - using langid and +library\\ +10.01.2014 & version 0.7 & improved license and documentation\\ +28.08.2015 & version 0.8 & changed GUI from tcl/tk to zenity and improved +documentation accordingly; added desktop configuration file\\ +\end{tabular} + +\section{Author, copyright, license, disclaimer} +\sffamily% +COPAC-CLEAN. Automatic editing of Copac/BibTeX records.\\ + Version 0.8\\ + Copyright (C) 2015 Guido Milanese <guido.milanese@unicatt.it> + + License: LaTeX Project Public License (LPPL 1.3c) + +This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. + +The latest version of this license is in +\begin{quote} + \url{http://www.latex-project.org/lppl.txt} +\end{quote} +and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Guido Milanese. + +This work consists of the files copac-clean.desktop, copac-clean.pdf, copac-clean.sno, copac-clean-lib.inc, copac-clean.sh, copac-clean.tex +\end{document} + |