Skip to content

Commit c31161e

Browse files
committed
Add README, IEEEtranplus.tex, and examples
1 parent 7f1cc24 commit c31161e

17 files changed

+278
-0
lines changed

IEEEtranplus.tex

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
% *** This file provides useful header content to be used in combination with IEEEtranplus.bst
2+
% *** Version 1.0
3+
4+
% Allow for hyperrefs in Bibliography
5+
\usepackage{hyperref}
6+
7+
% Indicates within each reference where in the document it is cited.
8+
\usepackage[hyperpageref]{backref}
9+
10+
% Improves formatting of backrefs.
11+
% See: https://tex.stackexchange.com/questions/183702/formatting-back-references-in-bibliography-bibtex
12+
\renewcommand*{\backrefalt}[4]{ % Improves formatting of backrefs
13+
\ifcase #1
14+
\or
15+
\\CITATIONS: page #2
16+
\else
17+
\\CITATIONS: pages #2
18+
\fi
19+
}
20+
21+
22+
% The showkeys package provides an alternative mechanism for displaying the citation keys.
23+
% Uncomment this line to enable:
24+
% \usepackage[notcite]{showkeys}
25+
26+
27+
28+
% * The following entries fix glitches when searching in PDF's
29+
30+
% Fixes issues with searching when the text includes ligatures. It seems these both fix the search while maintaining the ligatures - I chose one of them.
31+
% See https://tex.stackexchange.com/questions/67848/can-pdf-search-find-words-with-ligatures-in-xelatex-documents.
32+
\usepackage{lmodern}
33+
%\usepackage{times}
34+
35+
% Per https://tex.stackexchange.com/questions/439651/how-do-i-disable-ligatures, the following lines are the preferred solution to disable ligatures, but the microtype package causes errors.
36+
%\usepackage{microtype}
37+
%\DisableLigatures{encoding = *, family = * }
38+
39+
% This fixes an issue where search in PDF does not work when text contains underscores.
40+
% See: https://latex.org/forum/viewtopic.php?t=8891
41+
\usepackage[T1]{fontenc}

README.md

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# IEEEtranplus
2+
3+
## A verbose LaTeX Bibliography Style (bst) with local file links for collecting and organizing references
4+
5+
This tool is an extension of `IEEEtran.bst` (https://www.michaelshell.org/tex/ieeetran/) with some additional features.
6+
I use it as part of my private bibliography: an informal Latex document I built to collect and organize frequently-used references.
7+
It is not intended for use in publications.
8+
9+
For lack of a better name, I call this tool "IEEEtranplus".
10+
11+
## Key features
12+
13+
1. Supports a `file` field in BibTeX entries which links to one or more documents on your local computer.
14+
This *should* be compatible with the `file` field used by [JabRef](https://www.jabref.org/).
15+
16+
2. A verbose output of additional fields which are useful when collecting/organizing a repository of references:
17+
- **url**: A url to the publisher webpage (or other relevant url).
18+
- **docurl**: An alternate url that links directly to the document. For example, you could link to a copy of the document
19+
available online or through a library.
20+
- **library**: A free-form text field to list library call number, or other relevant info.
21+
- **citekey**: Displays the citation key for the entry. This makes it easy to copy and paste when you want to cite.
22+
- **note**: A free form text field for storing notes regarding the reference.
23+
24+
3. Provides a LaTeX script `IEEEtranplus.tex` with useful features:
25+
- Includes the `hyperref` package, which is needed by `IEEEtranplus.bst`.
26+
- Include `backref` package to indicate where in the document a reference is cited. This is useful for jumping
27+
back and forth between the document and references.
28+
- Various fixes for searching for text within a PDF document (to handle ligatures and underscores).
29+
30+
## Example
31+
Example BibTeX entry:
32+
```
33+
@book{PrincipiaMathematica:1927,
34+
author = "Whitehead, Alfred North and Russell, Bertrand Arthur William",
35+
title = "{Principia mathematica; 2nd ed.}",
36+
publisher = "Cambridge Univ. Press",
37+
year = "1927",
38+
url = "https://www.cambridge.org/us/universitypress/subjects/mathematics/logic-categories-and-sets/principia-mathematica?format=WX&isbn=9780521067911",
39+
docurl = "https://cds.cern.ch/record/268025",
40+
file = "Volume 1:PrincipiaMathematicaVol1.pdf;Volume 2:PrincipiaMathematicaVol2.pdf;Volume 3:PrincipiaMathematicaVol3.pdf",
41+
library = "Library of Congress: QA9.W5 1925",
42+
note = "The book can also be viewed online here: \href{https://www.loc.gov/item/25015133/}{Library of Congress}",
43+
}
44+
```
45+
46+
Produces the following output:
47+
```
48+
[1] A. N. Whitehead and B. A. W. Russell, Principia mathematica; 2nd ed. Cambridge Univ. Press, 1927
49+
URL: https://www.cambridge.org/us/universitypress/subjects/mathematics/logic-categories-and-sets/principia-mathematica?format=WX&isbn=9780521067911
50+
DOCURL: https://cds.cern.ch/record/268025
51+
FILE: PrincipiaMathematicaVol1.pdf Volume 1
52+
FILE: PrincipiaMathematicaVol2.pdf Volume 2
53+
FILE: PrincipiaMathematicaVol3.pdf Volume 3
54+
LIBRARY: Library of Congress: QA9.W5 1925
55+
NOTE: The book can also be viewed online here: Library of Congress
56+
CITEKEY: PrincipiaMathematica:1927
57+
CITATIONS: page 1
58+
```
59+
60+
Note that each field is displayed on its own line. Though this format is very verbose and can significantly extend the length
61+
of the document, I find it useful for my private bibliography to have all the info displayed in one place for easy browsing.
62+
63+
Full example documents are given in the examples folder.
64+
65+
66+
67+
## Usage
68+
- Optionally, include the `IEEEtranplus.tex` script in your document header to provide useful features.
69+
Use the command: `\input{IEEEtranplus}`
70+
71+
- Make sure to include package `hyperref` for links to work properly (this is already included in `IEEEtranplus.tex`).
72+
Use the command: `\usepackage{hyperref}` in your header.
73+
74+
- Call out the `IEEEtranplus.bst` style in your document using the command: `\bibliographystyle{IEEEtranplus}`
75+
76+
- The referenced files should be put in a `ref` subfolder under the folder where your compiled PDF is located
77+
(this folder is configurable by editing the `IEEEplanplus.bst` file's `file.folder` function). Then, depending on the
78+
PDF viewer you are using, you should be able to click on the file name in the PDF and the file will open. This should
79+
work in PDF viewers such as Adobe Acrobat and Chrome (tested on Windows). Many PDF viewers allow you to hold the
80+
"ctrl" key when clicking on the file to open it in a new tab/window.
81+
82+
- The format of the file field is as follows:
83+
- For a single file: `FILE = "description:file"` or `FILE = {description:file}`
84+
(as with other fields, you can use double quotes or curly braces).
85+
- The description is optional, i.e., you could just call out `FILE = "file"`
86+
- For multiple files, separate with a semicolon. For example:`FILE = "description1:file1;description2:file2"`
87+
- A file type can be provided. For example `FILE = description:file.pdf:PDF`.
88+
This type is only included for compatibility with JabRef, and `IEEEtranplus.bst` does not use this type in any way.
89+
90+
- There are various option flags in the "Options for IEEEtranplus" section of `IEEEtranplus.bst`, which can be enabled/disabled.
91+
92+
93+
94+
## Technical Notes
95+
- The function `escapechar` performs escaping of special characters.
96+
This function might need to be updated to support additional special characters in the future.
97+
98+
- The `file` field can handle HTML unicode entities (like `,`) in the file name.
99+
However, there is an issue with the hash tag `#` when used in a link within the `\href` command, even if it is escaped as `\#`.
100+
I am not sure how to resolve this. Even if this is resolved, e.g. using the `\url` command, it seems there are still
101+
issues with the PDF reader properly handling this case, so it is best to avoid using them anyway.
102+
Maybe this could be resolved by changing the category code of the # character.
103+
104+
- The parsing logic for the `file` field is based on the code/algorithm found in the
105+
[JabRef](https://www.jabref.org/) source code (version 4.3.1) inside the following files:
106+
- org/jabref/model/entry/FileFieldParser.java
107+
- org/jabref/model/entry/FileFieldWriter.java
108+
109+
- To include citation keys in the references, you could also use the `showkeys` package. The main reason I included this
110+
functionality directly in `IEEEtranplus.bst` is to show the key in-line with the text. Though `showkeys` is a great package,
111+
I had truncation/overlap issues with long keys or when in two column mode
112+
113+
- Debugging tips:
114+
- Some useful debugging commands for BST files:
115+
- Print debug message in log: `"message" top$`
116+
- Show element on top of stack: `duplicate$ top$`
117+
118+
- In MikTex, to see the `.bbl` file, perform separate compiles using PdfLatex first, and then BibText second.
119+
The `.bbl` should then be present in the working folder. Running PdfLatex again will make the final PDF from this
120+
`.bbl` file (you can edit the bbl and rerun PdfLatex during debugging).
121+
122+
- The BibLaTeX package documentation (http://mirror.hmc.edu/ctan/macros/latex/contrib/biblatex/doc/biblatex.pdf) was used
123+
as a reference when writing this tool. Note that the documentation does call out a `library` field, though I have never
124+
seen it used elsewhere.
125+
126+
- The file `IEEEtranplus.bst` is a Derived Work (as defined under the LaTeX Project Public License) written by Andre Beckus.
127+
The Original Work is as follows:
128+
- bibtex/IEEEtran.bst Version 1.14 (2015/08/26)
129+
- Copyright (c) 2003-2015 Michael Shell
130+
- Available from:
131+
- https://www.michaelshell.org/tex/ieeetran/
132+
- https://www.ctan.org/pkg/ieeetran
133+
- For a diff showing my modifications, see Github
134+
135+
136+
137+
## Files
138+
139+
- `README.md`: This file.
140+
- `IEEEtranplus.bst`: The main LaTeX Bibliography Style. Provides the core functionality of this tool.
141+
- `IEEEtranplus.tex`: An optional LaTeX script including additional functionality.
142+
- `examples/simple`: A simple example document.
143+
- `examples/detailed`: A detailed example showing various aspects of the functionality.
144+
145+
## Legal Notice
146+
This code is offered as-is without any warranty either expressed or
147+
implied; without even the implied warranty of MERCHANTABILITY or
148+
FITNESS FOR A PARTICULAR PURPOSE!
149+
User assumes all risk.
150+
In no event shall the IEEE or any contributor to this code be liable for
151+
any damages or losses, including, but not limited to, incidental,
152+
consequential, or any other damages, resulting from the use or misuse
153+
of any information contained here.
154+
155+
All comments are the opinions of their respective authors and are not
156+
necessarily endorsed by the IEEE.
157+
158+
This work is distributed under the LaTeX Project Public License (LPPL)
159+
( http://www.latex-project.org/ ) version 1.3, and may be freely used,
160+
distributed and modified. A copy of the LPPL, version 1.3, is included
161+
in the base LaTeX documentation of all distributions of LaTeX released
162+
2003/12/01 or later.
163+
Retain all contribution notices and credits.
164+
165+

examples/detailed/detailedexample.bib

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@Book{book_test,
2+
author = {First Author},
3+
title = {Example bibliography book entry},
4+
year = {2019},
5+
publisher = {Publisher},
6+
library = {Call number QA123.A45},
7+
url = {http://www.bibtex.org/},
8+
docurl = {http://www.google.org/},
9+
file = {filetest1.pdf},
10+
note = {This is a note. It behaves like standard \LaTeX code, and can contain equations $E=mc^2$. Even the cite command seems to work, so that you can cite other entries, e.g. \cite{inproceedings_test}. Make sure to escape special characters like underscores \_.},
11+
}
12+
13+
@Article{article_test,
14+
author = {Second Author},
15+
title = {Example article entry},
16+
journal = {Journal title},
17+
volume = {1},
18+
year = {2019},
19+
library = {Special characters like _ % # do NOT need to be escaped in this field. You cannot include things like equations here.},
20+
url = {http://www.jabref.org/},
21+
file = {A file with just a description:filetest1.pdf;A file with a description and type:filetest1.pdf:PDF;Escape semicolons which appear in the filename:filetest\;2.pdf;HTML unicode entities are handled by bst (although this example is broken due to issues with Latex - see README).:filetest,3.pdf:PDF;Subfolders can be used:refsub/filetest4.pdf;If backslash \\ is used, make sure to use double backslash \\\\ (in both description and file name):refsub\\filetest4.pdf},
22+
note = {This entry shows a couple of variations for the file field (these are compatible with JabRef). To include a description, use the format ``description:filename'' or ``description:filename:filetype'' (the bst does not use the filetype). The semicolon is used to separate files. The folder where the PDFs are located can be set by changing the ``file.folder'' function in the .bst file.}
23+
}
24+
25+
@InProceedings{inproceedings_test,
26+
author = {Third Author},
27+
title = {Example in proceedings entry},
28+
booktitle = {Proceedings title},
29+
volume = {1},
30+
year = {2019},
31+
pages = {1--10},
32+
url = {https://www.latex-project.org/},
33+
file = {Special characters such as _, %, and $ are handled properly. These should NOT be escaped in the description nor file name. Latex code and equations are not allowed in the description (this is a side effect of how the parsing works).:file_test%5$.pdf;Handle escaped colon in file, and ampersand at end of filename (this link does not actually work, though):filetest\:dummy.pdf&;If too many colons are used, they will be ignored:filetest1.pdf:with:too:many:colons;Test with other file types:filetest6.png},
34+
note = {This entry tests a couple special cases encountered in file names. The behavior should match that of JabRef.},
35+
}

examples/detailed/detailedexample.pdf

102 KB
Binary file not shown.

examples/detailed/detailedexample.tex

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
\documentclass{article}
2+
3+
\input{../../IEEEtranplus}
4+
5+
\begin{document}
6+
7+
This document contains a sample bibliography which demonstrates various features.
8+
These are the citations: \cite{book_test,article_test,inproceedings_test}.
9+
10+
\bibliographystyle{../../IEEEtranplus}
11+
\bibliography{detailedexample}
12+
13+
\end{document}
126 KB
Binary file not shown.
127 KB
Binary file not shown.

examples/detailed/refs/filetest1.pdf

33.2 KB
Binary file not shown.

examples/detailed/refs/filetest6.png

1.7 KB
Loading

examples/detailed/refs/filetest;2.pdf

126 KB
Binary file not shown.
125 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

examples/simple/simpleexample.bib

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@book{PrincipiaMathematica:1927,
2+
author = "Whitehead, Alfred North and Russell, Bertrand Arthur William",
3+
title = "{Principia mathematica; 2nd ed.}",
4+
publisher = "Cambridge Univ. Press",
5+
year = "1927",
6+
url = "https://www.cambridge.org/us/universitypress/subjects/mathematics/logic-categories-and-sets/principia-mathematica?format=WX&isbn=9780521067911",
7+
docurl = "https://cds.cern.ch/record/268025",
8+
file = "Volume 1:PrincipiaMathematicaVol1.pdf;Volume 2:PrincipiaMathematicaVol2.pdf;Volume 3:PrincipiaMathematicaVol3.pdf",
9+
library = "Library of Congress: QA9.W5 1925",
10+
note = "The book can also be viewed online here: \href{https://www.loc.gov/item/25015133/}{Library of Congress}",
11+
}

examples/simple/simpleexample.pdf

74.3 KB
Binary file not shown.

examples/simple/simpleexample.tex

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
\documentclass{article}
2+
3+
\input{../../IEEEtranplus}
4+
5+
\begin{document}
6+
7+
This document contains a sample bibliography.
8+
This is a reference to Principia Mathematica: \cite{PrincipiaMathematica:1927}.
9+
10+
\bibliographystyle{../../IEEEtranplus}
11+
\bibliography{simpleexample}
12+
13+
\end{document}

0 commit comments

Comments
 (0)