[PATCH 1/2] Add script to tweak output of 'alphapf' bibliography stile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 446d9fb1743d3750b06923e32f449469cb1364de Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Sun, 25 Dec 2016 19:59:58 +0900
Subject: [PATCH 1/2] Add script to tweak output of 'alphapf' bibliography stile

"inlinelinks" in alphapf.bst caused PDFTeX to abort.
This was because href-ed long titles in Bibliography can cross
page boundaries. The combination of PDFTeX and "hyperref" package
can't handle such a situation.
You can avoid the issue by manually adjust page breaks. But in
perfbook, page boundaries in Bibliography can not be controlled
precisely.
This commit adds a script to convert \href related output of BiBTeX
on the fly. It shortens the href-ed part in title strings to the
beginning of two characters.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 Makefile                    |  1 +
 utilities/tweakhrefinbbl.pl | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 utilities/tweakhrefinbbl.pl

diff --git a/Makefile b/Makefile
index f0944f0..0ace9dc 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@ $(PDFTARGETS): %.pdf: %.tex %.bbl
 
 $(PDFTARGETS:.pdf=.bbl): %.bbl: %.aux
 	bibtex $(basename $@)
+	perl utilities/tweakhrefinbbl.pl $@
 
 $(PDFTARGETS:.pdf=.aux): $(LATEXSOURCES) $(LATEXGENERATED) $(BIBSOURCES)
 	sh utilities/runfirstlatex.sh $(basename $@)
diff --git a/utilities/tweakhrefinbbl.pl b/utilities/tweakhrefinbbl.pl
new file mode 100644
index 0000000..6727a28
--- /dev/null
+++ b/utilities/tweakhrefinbbl.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -pi
+# Tweak output of BiBTeX with alphapf bibliography style
+#
+# This script does the following conversion in .bbl
+#
+#  o \newblock \href {http://URL} {Title of the site}.
+#    ->
+#    \newblock \href {http://URL} {Ti}{tle of the site}.
+#  o \newblock \href {http://URL} {{\em Book Title}}.
+#    ->
+#    \newblock \href {http://URL} {{\em {Bo}}}{\em {ok Title}}.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <akiyks@xxxxxxxxx>
+
+use strict;
+use warnings;
+
+BEGIN {undef $/;}
+
+s/\\newblock \\href\s+\{([^}]*)\}\s+\{([^\\\{]{1}\S?)(.*?)\}\.$/\\newblock \\href {$1} {$2}{$3}./smg ;
+s/\\newblock \\href\s+\{([^}]*)\}\s+\{\{\\em\s+([^\\\{]{1}\S?)(.*?)\}\.$/\\newblock \\href {$1} {{\\em {$2}}}{\\em {$3}./smg ;
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux