{"id":17972363,"url":"https://github.com/hygull/bibtex","last_synced_at":"2025-10-29T22:42:00.202Z","repository":{"id":57116957,"uuid":"193609555","full_name":"hygull/bibtex","owner":"hygull","description":"A node/npm package to get details about BibTeX (.bib), its syntax, available ENTRY types and many more using Node APIs.","archived":false,"fork":false,"pushed_at":"2019-08-22T10:34:11.000Z","size":388,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T03:41:33.504Z","etag":null,"topics":["bibtex","entrytype","json","nodejs","scrapping"],"latest_commit_sha":null,"homepage":"https://hygull.github.io/bibtex/.","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hygull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-25T01:22:25.000Z","updated_at":"2022-07-24T08:14:56.000Z","dependencies_parsed_at":"2022-08-22T22:20:20.637Z","dependency_job_id":null,"html_url":"https://github.com/hygull/bibtex","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hygull%2Fbibtex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hygull%2Fbibtex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hygull%2Fbibtex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hygull%2Fbibtex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hygull","download_url":"https://codeload.github.com/hygull/bibtex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245462958,"owners_count":20619585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bibtex","entrytype","json","nodejs","scrapping"],"created_at":"2024-10-29T16:13:29.025Z","updated_at":"2025-10-29T22:42:00.127Z","avatar_url":"https://github.com/hygull.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 id=\"top\"\u003ebibtex\u003c/h1\u003e\n\n![npm](https://img.shields.io/npm/dw/@hygull/bibtex.svg?label=downloads) ![npm (scoped)](https://img.shields.io/npm/v/@hygull/bibtex.svg?label=%40hygull%2Fbibtex)\n\n\u003e ## `npm i @hygull/bibtex`\n\nA node/npm package to get details about BibTeX (.bib), its syntax, available ENTRY types and many more using Node APIs.\n\n\n\u003e You can also visit https://hygull.github.io/bibtex/ to see the beautiful documentation for the same.\n\n![https://raw.githubusercontent.com/hygull/bibtex/master/docs/images/BibTeX.jpg](https://raw.githubusercontent.com/hygull/bibtex/master/docs/images/BibTeX.jpg)\n\n## Installation\n\n\u003e You can check https://docs.npmjs.com/getting-started/using-a-package.json for more commands.\n\n| Type   | Command |\n| --- | --- |\n| Local   | `npm i @hygull/bibtex` |\n| Global  | `npm i @hygull/bibtex -g` |\n\n\u003c!-- If you want to try this package and getting started soon without any problems, please visit [https://hygull.github.io/bibtex-test/](https://hygull.github.io/bibtex-test/) and follow the steps mentioned. --\u003e\n\n\u003chr\u003e\n\n### What is BibTeX?\n\nBibTeX is a reference management program that makes it easy for users of TeX and LaTeX to generate bibliographies for books and journal articles. When possible, it is usually stylized in the TeX font the way TeX and LaTeX are. LaTeX was first created in 1985 by Leslie Lamport and Oren Patashnik.\n\n### What is a BibTeX key?\n\nA BibTeX key is a unique identifier for a reference in a BibTeX file. To cite a reference in a TeX document, you insert the BibTeX key for the reference in the correct place in the document. When the document is converted to its final output format, the BibTeX keys are replaced with the correct, formatted citations.\n\n### What is BibTex file?\n\nDocument containing information in the BibTeX format; contains one or more references and enables bibliographies to be searched and published using standard commands.\n\nBibTeX files may include bibliographies for books, articles, research papers, tech reports, etc. The information in the file includes author name, title, journal, volume, year of publication, number of pages, and notes.\n\n\u003chr\u003e\n\n## Examples\n\n[Example 1 - Get all entry types](#example1)\n\n[Example 2 - Get all entry type with fields (required + optional)](#example2)\n\n[Example 3 - Get Specific entry type with fields (pass the name of entry type) ](#example3)\n\n[Example 4 - Get little description about entry types ](#example4)\n\n[Example 5 - Get entry types, fields, description](#example5)\n\n[Example 6 - Getting HTML Code (form) for a specific entry type](#example6)\n\n[Example 7 - Get fields (standard fields)](#example7)\n\n[Example 8 - Get BibTeX template code for a specific entry type in 3 different formats](#example8)\n\n[Example 9 - Get object/array from BibTeX code (in .bib files)](#example9)\n\n[Example 10 - Get BibTeX code (for .bib files) from an object/array](#example10)\n\n\u003e Now, please have a look at the below examples.\n\n\u003ch3 id=\"example1\"\u003eExample 1 - Get all entry types\u003c/h3\u003e\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\n// Instantiating BibTex (class)\nconst bib = new bibtex(); \n\n// A list containing all possible entry types for a .bib file\nconst entryTypes = bib.getEntryTypes();\n\nconsole.log(entryTypes);\n/*\n[ 'article',\n  'book',\n  'booklet',\n  'conference',\n  'inbook',\n  'incollection',\n  'inproceedings',\n  'manual',\n  'mastersthesis',\n  'misc',\n  'phdthesis',\n  'proceedings',\n  'techreport',\n  'unpublished' ]\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example2\"\u003eExample 2 - Get all entry type with fields (required + optional)\u003c/h3\u003e\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\n// Instantiating BibTex (class)\nconst bib = new bibtex(); \n\n// A list containing all possible entry types for a .bib file\n// with fields (required + optional)\nconst entryTypeFields = bib.getEntryTypeFields();\n\n// Printing (entry type: book)\nvar articleEntryFields = entryTypeFields[\"article\"];\nconsole.log(articleEntryFields);\n/*\n{ requiredFields: [ 'author', 'title', 'journal', 'year' ],\n  optionalFields: [ 'volume', 'number', 'pages', 'month', 'note', 'key' ] }\n*/\n\n// Pretty printing (entry type: book)\nvar bookEntryFields = entryTypeFields['book'];\nconsole.log(JSON.stringify(bookEntryFields, null, 4));\n/*\n  {\n      \"requiredFields\": [\n          \"author or editor\",\n          \"title\",\n          \"publisher\",\n          \"year\"\n      ],\n      \"optionalFields\": [\n          \"volume\",\n          \"series\",\n          \"address\",\n          \"edition\",\n          \"month\",\n          \"note\",\n          \"key\"\n      ]\n  }\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example3\"\u003eExample 3 - Get Specific entry type with fields (pass the name of entry type)\u003c/h3\u003e\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst proceedingsEntryFields = bib.getSpecificEntryTypeFields(\"proceedings\");\n\n// Pretty printing (entry type: proceedings)\nconsole.log(JSON.stringify(proceedingsEntryFields, null, 4));\n\n/*\n\t{\n\t    \"requiredFields\": [\n\t        \"title\",\n\t        \"year\"\n\t    ],\n\t    \"optionalFields\": [\n\t        \"editor\",\n\t        \"publisher\",\n\t        \"organization\",\n\t        \"address\",\n\t        \"month\",\n\t        \"note\"\n\t    ]\n\t}\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example4\"\u003eExample 4 - Get little description about entry types\u003c/h3\u003e\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst entryTypeDescription = bib.getEntryTypeDescription();\n\n// Pretty printing \nconsole.log(JSON.stringify(entryTypeDescription, null, 4));\n\n/*\n{\n\t\"article\": \"An article from a journal or magazine.\",\n\t\"book\": \"A book with an explicit publisher.\",\n\t\"booklet\": \"A work that is printed and bound, but without a named publisher \n\tor sponsoring institution.\",\n\t\"inbook\": \"A part of a book, e.g., a chpater, section, or whatever and/or a range \n\tof pages.\",\n\t\"incolllection\": \"A part of a book having its own title.\",\n\t\"inproceedings\": \"An article in a conference proceedings.\",\n\t\"manual\": \"Technical documentation.\",\n\t\"mastersthesis\": \"A master's thesis.\",\n\t\"misc\": \"Use this type when nothing else fits. A warning will be issued if all\n\t optional fields are empty (i.e., the entire entry is empty or has only ignored fields).\",\n\t\"phdthesis\": \"A Ph.D. thesis.\",\n\t\"proceedings\": \"Conference proceedings.\",\n\t\"techreport\": \"A report published by a school or other institution, usually \n\tnumbered within a series.\",\n\t\"unpublished\": \"A document having an author and title, but not formally published.\"\n}\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example5\"\u003eExample 5 - Get entry types, fields, description\u003c/h3\u003e\n\n\u003e Based on the scrapped data (using Python 3) from [http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article](http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article).\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst entryTypeFieldsDescription = bib.getEntryTypeFieldsDescription();\n\n// Pretty printing\nconsole.log(JSON.stringify(entryTypeFieldsDescription, null, 4));\n\n/*\n{\n    \"article\": {\n        \"description\": \"An article from a journal or magazine\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"journal\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"volume\",\n            \"number\",\n            \"pages\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"book\": {\n        \"description\": \"A book with an explicit publisher\",\n        \"requiredFields\": [\n            \"author or editor\",\n            \"title\",\n            \"publisher\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"volume or number\",\n            \"series\",\n            \"address\",\n            \"edition\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"booklet\": {\n        \"description\": \"A work that is printed and bound, but without a named publisher or sponsoring institution\",\n        \"requiredFields\": [\n            \"title\"\n        ],\n        \"optionalFields\": [\n            \"author\",\n            \"howpublished\",\n            \"address\",\n            \"month\",\n            \"year\",\n            \"note\"\n        ]\n    },\n    \"inbook\": {\n        \"description\": \"A part of a book, e.g., a chpater, section, or whatever and/or a range of pages\",\n        \"requiredFields\": [\n            \"author or editor\",\n            \"title\",\n            \"chapter and/or pages\",\n            \"publisher\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"volume or number\",\n            \"series\",\n            \"type\",\n            \"address\",\n            \"edition\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"incollection\": {\n        \"description\": \"A part of a book having its own title\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"booktitle\",\n            \"publisher\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"editor\",\n            \"volume or number\",\n            \"series\",\n            \"type\",\n            \"chapter\",\n            \"pages\",\n            \"address\",\n            \"edition\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"inproceedings\": {\n        \"description\": \"An article in a conference proceedings\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"booktitle\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"editor\",\n            \"volume or number\",\n            \"series\",\n            \"pages\",\n            \"address\",\n            \"month\",\n            \"organization\",\n            \"publisher\",\n            \"note\"\n        ]\n    },\n    \"manual\": {\n        \"description\": \"Technical documentation\",\n        \"requiredFields\": [\n            \"title\"\n        ],\n        \"optionalFields\": [\n            \"author\",\n            \"organization\",\n            \"address\",\n            \"edition\",\n            \"month\",\n            \"year\",\n            \"note\"\n        ]\n    },\n    \"mastersthesis\": {\n        \"description\": \"A master's thesis\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"school\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"type\",\n            \"address\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"misc\": {\n        \"description\": \"Use this type when nothing else fits. A warning will be issued if all optional fields are empty (i.e., the entire entry is empty or has only ignored fields)\",\n        \"requiredFields\": [\n            \"none\"\n        ],\n        \"optionalFields\": [\n            \"author\",\n            \"title\",\n            \"howpublished\",\n            \"month\",\n            \"year\",\n            \"note\"\n        ]\n    },\n    \"phdthesis\": {\n        \"description\": \"A Ph.D. thesis\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"school\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"type\",\n            \"address\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"proceedings\": {\n        \"description\": \"Conference proceedings\",\n        \"requiredFields\": [\n            \"title\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"editor\",\n            \"volume or number\",\n            \"series\",\n            \"address\",\n            \"publisher\",\n            \"note\",\n            \"month\",\n            \"organization\"\n        ]\n    },\n    \"techreport\": {\n        \"description\": \"A report published by a school or other institution, usually numbered within a series\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"institution\",\n            \"year\"\n        ],\n        \"optionalFields\": [\n            \"type\",\n            \"number\",\n            \"address\",\n            \"month\",\n            \"note\"\n        ]\n    },\n    \"unpublished\": {\n        \"description\": \"A document having an author and title, but not formally published\",\n        \"requiredFields\": [\n            \"author\",\n            \"title\",\n            \"note\"\n        ],\n        \"optionalFields\": [\n            \"month\",\n            \"year\"\n        ]\n    }\n}\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example6\"\u003eExample 6 - Getting HTML Code (form) for a specific entry type\u003c/h3\u003e\n\n\u003e Bootstrap 3 form element (Inspired from [https://www.w3schools.com/bootstrap/bootstrap_forms.asp](https://www.w3schools.com/bootstrap/bootstrap_forms.asp)).\n\u003e\n\u003e Curretly, all input fields are of type `'text'` (even if it is a number like `year` etc.). User can add javascript code for validation of form fields or use his/her own approach for validations \u0026 design(using custom stylesheets) etc.\n\u003e\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst formCode = bib.getFormFor('article');\n\n// Pretty printing \nconsole.log(formCode);\n\n/*\n\u003cform action='#' method='GET' name='article'\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='author'\u003eauthor:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='author' placeholder='Enter author' name='author' required='true'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='title'\u003etitle:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='title' placeholder='Enter title' name='title' required='true'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='journal'\u003ejournal:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='journal' placeholder='Enter journal' name='journal' required='true'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='year'\u003eyear:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='year' placeholder='Enter year' name='year' required='true'\u003e\n        \u003c/div\u003e\n\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='volume'\u003evolume:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='volume' placeholder='Enter volume' name='volume' required='false'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='number'\u003enumber:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='number' placeholder='Enter number' name='number' required='false'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='pages'\u003epages:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='pages' placeholder='Enter pages' name='pages' required='false'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='month'\u003emonth:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='month' placeholder='Enter month' name='month' required='false'\u003e\n        \u003c/div\u003e\n        \u003cdiv class='form-group'\u003e\n                \u003clabel for='note'\u003enote:\u003c/label\u003e\n                \u003cinput type='text' class='form-control' id='note' placeholder='Enter note' name='note' required='false'\u003e\n        \u003c/div\u003e\n        \u003cbutton type='submit' class='btn btn-success'\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\u003ch3 id=\"example7\"\u003eExample 7 - Get fields (standard fields)\u003c/h3\u003e\n\n\u003e Based on the scrapped data from [http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#annote](http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#annote).\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst fields = bib.getFields('article');\n\n// Pretty printing \nconsole.log(JSON.stringify(fields, null, 4));\n\n/*\n{\n    \"address\": {\n        \"description\": \"Usually the address of the publisher or other institution.\",\n        \"note\": \"For major publishing houses, you may omit the information entirely or give simply the\ncity. For small publishers, on the other hand, you can help the reader by giving the complete address.\"\n    },\n    \"annote\": {\n        \"description\": \"An annotation.\",\n        \"note\": \"Not used by the standard bibliography styles, but used by others that produce an annot\nated bibliography (e.g., annote). The field starts a new sentence and hence the first word should be ca\npitalized.\"\n    },\n    \"author\": {\n        \"description\": \"The name(s) of the author(s), in BibTeX name format.\",\n        \"note\": \"This field should contain the complete author list for your entry. The names are separ\nated by the word and, even if there are more than two authors. Each name can be written in two equivale\nnt forms: Donald E. Knuth or Knuth, Donald E. Eddie van Halen or van Halen, Eddie The second form shoul\nd be used for authors with more than two names, to differentiate between middle names and last names.\"\n    },\n    \"booktitle\": {\n        \"description\": \"Title of a book, part of which is being cited.\",\n        \"note\": \"For book entries use the title field\"\n    },\n    \"chapter\": {\n        \"description\": \"A chapter (or section or whatever) number.\",\n        \"note\": \"It's an integer denoting the page number.\"\n    },\n    \"crossref\": {\n        \"description\": \"The database key of the entry being cross-referenced\",\n        \"note\": \"The database key of the entry being cross referenced.\"\n    },\n    \"edition\": {\n        \"description\": \"The edition of a book (e.g., \\\"Second\\\").\",\n        \"note\": \"This should be an ordinal, and should have the first letter capitalized, as shown abov\ne; the standard styles convert to lowercase when necessary.\"\n    },\n    \"editor\": {\n        \"description\": \"\",\n        \"note\": \"If there is also an author field, then the editor field gives the editor of the book o\nr collection in which the reference appears.\"\n    },\n    \"howpublished\": {\n        \"description\": \"How something strange has been published.\",\n        \"note\": \"The first word should be capitalized.\"\n    },\n    \"institution\": {\n        \"description\": \"Institutuion sponsoring a technical report.\",\n        \"note\": \"It is the name of institution\"\n    },\n    \"journal\": {\n        \"description\": \"Journal name. Abbrevations are provided for many journals.\",\n        \"note\": \"The name of a journal or magazine. The name of a journal can be abbreviated using a “s\ntring”. To define such string, use the string editor.\"\n    },\n    \"key\": {\n        \"description\": \"Used for alphabetizing, cross-referencing, and creating a label when the author\n and editor information is missing.\",\n        \"note\": \"This field should not be confused with the key that appears in the \\\\cite command and\nat the beginning of the database entry.\"\n    },\n    \"month\": {\n        \"description\": \"The month in which the work was published or, for an unpublished work, in which\n it was written.\",\n        \"note\": \"For reasons of consistency the standard three-letter abbreviations (jan, feb, mar, etc\n.) should be used.\"\n    },\n    \"note\": {\n        \"description\": \"Any additional information that can help the reader.\",\n        \"note\": \"Descriptive information to help the reader.\"\n    },\n    \"number\": {\n        \"description\": \"The number of a journal, magazine, technical report, or work in a series.\",\n        \"note\": \"An issue of a journal or magazine is usually identified by its volume and number; a te\nchnical report normally has a number; and sometimes books in a named series carry numbers.\"\n    },\n    \"organization\": {\n        \"description\": \"The organization that sponsors a conference or that publishes a manual.\",\n        \"note\": \"It is the name of organization that takes care of publishing the manual.\"\n    },\n    \"pages\": {\n        \"description\": \"One or more page numbers or range of numbers.\",\n        \"note\": \"(e.g., 42-111 or 7,41, 73-97 or 43+, where the '+' indicates pages that do not form a\nsimple range)\"\n    },\n    \"publisher\": {\n        \"description\": \"The publisher's name.\",\n        \"note\": \"The name of the publisher.\"\n    },\n    \"school\": {\n        \"description\": \"The name of the school where the thesis was written.\",\n        \"note\": \"The name of school.\"\n    },\n    \"series\": {\n        \"description\": \"The name of a series or set of books.\",\n        \"note\": \"When citing an entire book, the title field gives its title and an optional series fie\nld gives the name of a series or multivolume set in which the book is published.\"\n    },\n    \"title\": {\n        \"description\": \"The work's title, typed as explained in\",\n        \"note\": \" The title of the work. The capitalization may depend on the bibliography style and on\n the language used. For words that have to be capitalized (such as a proper noun), enclose the word (or\n its first letter) in braces.\"\n    },\n    \"type\": {\n        \"description\": \"The type of a technical report(e.g., \\\"Research Note\\\").\",\n        \"note\": \"This name is used instead of the default \\\"Technical Report\\\". For the entry type phdt\nhesis you could use the term \\\"Ph.D. dissertation\\\" by specifying: type = \\\"{Ph.D.} dissertation\\\". Sim\nilarly, for the inbook and incollection entry types you can get \\\"section 1.2\\\" instead of the default\n\\\"chapter 1.2\\\" with chapter = \\\"1.2\\\" and type = \\\"Section\\\".\"\n    },\n    \"volume\": {\n        \"description\": \"The volume of a journal or multivolume book.\",\n        \"note\": \"The volume of a journal or multivolume book\"\n    },\n    \"year\": {\n        \"description\": \"The year of publication or, for an unpublished work, the year it was written.\",\n        \"note\": \"Generally, it should consist of four numerals, such as 1984, although the standard sty\nles can handle any year whose last four nonpunctuation characters are numerals, such as \\\"about 1984\\\".\n\"\n    }\n}\n*/\n```\n\u0026raquo; [Back to top](#top)\n\n\n\u003ch3 id=\"example8\"\u003eExample 8 -  Get BibTeX template code for a specific entry type in 3 different formats\u003c/h3\u003e\n\n\u003e `getBibTeXTemplateFor()` takes 2 parameters where only first is required.\n\u003e\n\u003e Second parameter denotes the type of output to be obtained which is an\n\u003e integer (default value: `1`).\n\u003e\n\u003e So `getBibTeXTemplateFor(\"book\")` is similar to `getBibTeXTemplateFor(\"book\", 1)`.\n\u003e\n\u003e Currently, there're only 3 formats available so format can take value of `1`/`2`/`3`.\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\nconst bibTeXTemplateForManual = bib.getBibTeXTemplateFor('manual'); \n\nconsole.log(bibTeXTemplateForManual);\n\n/*\n    @manual{manualKey,\n            article = {\"\"},\n            book = {\"\"},\n            booklet = {\"\"},\n            conference = {\"\"},\n            inbook = {\"\"},\n            incollection = {\"\"},\n            inproceedings = {\"\"},\n            manual = {\"\"}\n    }\n*/\n```\n\n\n```javascript\nconst bibTeXTemplateForManual2 = bib.getBibTeXTemplateFor('manual', 2); \n\nconsole.log(bibTeXTemplateForManual2);\n\n/*\n    @manual{manualKey,\n            article = \"\",\n            book = \"\",\n            booklet = \"\",\n            conference = \"\",\n            inbook = \"\",\n            incollection = \"\",\n            inproceedings = \"\",\n            manual = \"\"\n    }\n*/\n```\n\n```javascript\nconst bibTeXTemplateForManual3 = bib.getBibTeXTemplateFor('manual', 3); \n\nconsole.log(bibTeXTemplateForManual3);\n/*\n    @manual{manualKey,\n            article = {},\n            book = {},\n            booklet = {},\n            conference = {},\n            inbook = {},\n            incollection = {},\n            inproceedings = {},\n            manual = {}\n    }\n*/\n```\n\n\u0026raquo; [Back to top](#top)\n\n\u003ch3 id=\"example9\"\u003eExample 9 -  Get object/array from BibTeX code (in .bib files)\u003c/h3\u003e\n\n\u003e Check [Citing and referencing in LaTeX - using BibTeX (pdf)](https://gitlab.com/hygull/tech-pdfs/blob/master/latex/bibtex/Citing-And-References-in-LaTeX-BibTeX.pdf), it might be very useful to\nunderstand the standard structure of a Bib(.bib) file.\n\n    @entryType{key,\n       field1 = \"value1\",\n       field2 = \"value2\"\n    }\n\nor\n\n    @entryType{key,\n       field1 = {value1},\n       field2 = {value2}\n    }\n\nLet suppose we have a file named [`BibTeX_example02_misc.bib`](https://github.com/hygull/bibtex/blob/master/docs/examples/BibTeX_example02_misc.bib) with the following content.\n\n\u003e BibTeX_example02_misc.bib\n\n```bibtex\n@misc{Nobody06,\n       author = \"Nobody Jr\",\n       title = \"My Article\",\n       year = \"2006\" }\n```\n\nBelow is the code to read the above file and get it as an object.\n\n\u003e #### 9.1 Single bib entry specification, (curley braced representation)\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\nconst bib = new bibtex();\n\n/* NOTE:\n    + Path should be related to the location from where we're running the command.\n\n    + As we supposed to execute this from the root of the package.\n\n    + That is why `.\\\\docs\\\\examples\\\\BibTeX_example02_misc.bib` is correct\n    \n    + not `..\\\\docs\\\\examples\\\\BibTeX_example02_misc.bib`.\n*/\n\n// Bib file path (Absoulte/Relative)\n// './docs/examples/BibTeX_example02_misc.bib'\n// '.\\\\docs\\\\examples\\\\BibTeX_example02_misc.bib' also works fine in Windows\nconst bibObject = bib.getBibAsObject('./docs/examples/BibTeX_example02_misc.bib');\n// const bibObject = bib.getBibMetaData('.\\\\docs\\\\examples\\\\BibTeX_example02_misc.bib');\n\n// Pretty print\nconsole.log(JSON.stringify(bibObject, null, 4));\n/*\n    {\n        \"entryType\": \"misc\",\n        \"key\": \"Nobody06\",\n        \"data\": {\n            \"author\": \"Nobody Jr\",\n            \"title\": \"My Article\",\n            \"year\": 2006\n        }\n    }\n*/\n```\n\nNow let's have a look at another example [`BibTeX_example08_book_diff.bib`](https://github.com/hygull/bibtex/blob/master/docs/examples/BibTeX_example08_book_diff.bib) to get its object form.\n\n```bibtex\n@book{bookKey,\n    author = {I J Kuss},\n    title = {In the top of mountain in the world},\n    edition = {5},\n    publisher = {Dilbert Books},\n    address = {Cambridge MA},\n    year = {1995}\n}\n```\n\nAnd below is the code that reads and returns an object containing the details of input bib file.\n\n\u003e #### 9.2 Single bib entry specification, (double quoted representation)\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\nconst bib = new bibtex();\n\nconst bibObject = bib.getBibAsObject('./docs/examples/BibTeX_example08_book_diff.bib');\nconsole.log(JSON.stringify(bibObject, null, 4));\n\n/*\n    {\n        \"entryType\": \"book\",\n        \"key\": \"bookKey\",\n        \"data\": {\n            \"author\": \"I J Kuss\",\n            \"title\": \"In the top of mountain in the world\",\n            \"edition\": 5,\n            \"publisher\": \"Dilbert Books\",\n            \"address\": \"Cambridge MA\",\n            \"year\": 1995\n        }\n    }\n*/\n```\n\n\u0026raquo; [Back to top](#top)\n\n\nNow, have a look at this another example [`BibTeX_multiple.bib`](https://github.com/hygull/bibtex/blob/master/docs/examples/BibTeX_multiple.bib) which have multiple bib\nentries, so here we're going to get an array of bib objects using the same method as we used above.\n\n```bibtex\n@Book{michael,\n    author = \"Michael Jackson\",\n    title = \"My Kingdom For A Lollypop\",\n    publisher = \"Neverland \\\u0026 Everland Publishing\",\n    year = \"2004\"\n}\n\n@Book{elvis,\n    author = {Elvis Presley},\n    title = {Turn Me One More Time},\n    publisher = {Jail House Books},\n    year = {1963}\n}\n\n@Book{britney,\n    author = \"Britn ey Spears\",\n    title = \"Let's Go Oversea To Canada\",\n    publisher = \"Blonde, Blondt \\\u0026 Blondey\",\n    year = \"2007\",\n}\n\n@Book{marilyn,\n    author = {Marilyn Manson},\n    title = {I Love My Little Pony},\n    publisher = {Pinc \\\u0026 Cuddley Press},\n    year = {2005},\n}\n\n@Book{elvis,\n    author = \"Elvis Presley\",\n    title = \"Turn Me One More Time\",\n    publisher = \"Jail House Books\",\n    year = \"1963\"\n}\n```\n\nBelow is the javascript code that reads the [`BibTeX_multiple.bib`](https://github.com/hygull/bibtex/blob/master/docs/examples/BibTeX_multiple.bib) \nand returns an array of bib objects.\n\n\u003e #### 9.3 - Multiple bib entries specification (get an array of bib objects)\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\nconst bib = new bibtex();\n\n// Getting an array of bib objects\nconst bibArr = bib.getBibAsObject('./docs/examples/BibTeX_multiple.bib');\nconsole.log(JSON.stringify(bibArr, null, 4));\n\n/*\n[\n    {\n        \"entryType\": \"Book\",\n        \"key\": \"michael\",\n        \"data\": {\n            \"author\": \"Michael Jackson\",\n            \"title\": \"My Kingdom For A Lollypop\",\n            \"publisher\": \"Neverland \\\\\u0026 Everland Publishing\",\n            \"year\": 2004\n        }\n    },\n    {\n        \"entryType\": \"Book\",\n        \"key\": \"elvis\",\n        \"data\": {\n            \"author\": \"Elvis Presley\",\n            \"title\": \"Turn Me One More Time\",\n            \"publisher\": \"Jail House Books\",\n            \"year\": 1963\n        }\n    },\n    {\n        \"entryType\": \"Book\",\n        \"key\": \"britney\",\n        \"data\": {\n            \"author\": \"Britn ey Spears\",\n            \"title\": \"Let's Go Oversea To Canada\",\n            \"publisher\": \"Blonde, Blondt \\\\\u0026 Blondey\",\n            \"year\": 2007\n        }\n    },\n    {\n        \"entryType\": \"Book\",\n        \"key\": \"marilyn\",\n        \"data\": {\n            \"author\": \"Marilyn Manson\",\n            \"title\": \"I Love My Little Pony\",\n            \"publisher\": \"Pinc \\\\\u0026 Cuddley Press\",\n            \"year\": 2005\n        }\n    },\n    {\n        \"entryType\": \"Book\",\n        \"key\": \"elvis\",\n        \"data\": {\n            \"author\": \"Elvis Presley\",\n            \"title\": \"Turn Me One More Time\",\n            \"publisher\": \"Jail House Books\",\n            \"year\": 1963\n        }\n    }\n]\n*/\n```\n\n\u0026raquo; [Back to top](#top)\n\n\n\n\u003ch3 id=\"example10\"\u003e Get BibTeX code (for .bib files) from an object/array\u003c/h3\u003e\n\n\u003e The function takes 2 parameters, 1st is required and 2nd is default parameter (with default value 2).\n\u003e\n\u003e 1st parameter denotes an object/array.\n\u003e\n\u003e 2nd parameter denotes the format of resulting BibTeX code that we wish to obtain.\n\u003e\n\u003e    - This function will only be called in case if\n\u003e    The object in calling code is an array =\u003e [{...}, {...}, {...}, ...]\n\u003e   \n\u003e    - object in this function denotes any one of items available in the array\n\u003e    - format will be either 1/2/3\n\u003e    - 1 is for double quoted + curley braced representation =\u003e @article{articleKey,title={\"The age of programming\"}, ...}\n\u003e    - 2 is for double quoted representation =\u003e @article{articleKey,title=\"The age of programming\", ...}\n\u003e    - 3 is for curley braced representation  =\u003e @article{articleKey,title={The age of programming}, ...}\n\nThe below code explains the coversion process well with related outputs as comments.\n\n```javascript\nconst bibtex = require(\"@hygull/bibtex\");\n\nconst bib = new bibtex();\n\n// EXAMPLE 1\n// BibTeX entry\nconst object =  {\n            entryType: 'article', \n            key: 'articleKey', \n            data: {\n                'author': 'Raghvendra Thakur',\n                'title': 'The final decision of an old monkey',\n                'year': 2007,\n                'journal': 'Annals of Mathematical Logic'\n            }\n        };\n\nconst bibCode = bib.getBibCodeFromObject(object); // Default format 2 will be used (for double quoted representation)\nconsole.log(bibCode);\n/*\n    @article{articleKey,\n        author = \"Raghvendra Thakur\",\n        title = \"The final decision of an old monkey\",\n        year = \"2007\",\n        journal = \"Annals of Mathematical Logic\"\n    }   \n*/\n```\n\nBelow is the code for conversion from an array of objects to BibTeX code.\n\n```javascript\n// EXAMPLE 2\n// Array of BibTeX entries\nconst arr = [\n        {\n            \"entryType\": \"Book\",\n            \"key\": \"michael\",\n            \"data\": {\n                \"author\": \"Michael Jackson\",\n                \"title\": \"My Kingdom For A Lollypop\",\n                \"publisher\": \"Neverland \\\\\u0026 Everland Publishing\",\n                \"year\": 2004\n            }\n        },\n        {\n            \"entryType\": \"techreport\",\n            \"key\": \"techReportKey\",\n            \"data\": {\n                \"author\": \"Elvis Presley\",\n                \"title\": \"Turn Me One More Time\",\n                \"institution\": \"Garry insitute of Badoda\",\n                \"year\": 1963\n            }\n        },\n        {\n            \"entryType\": \"inproceedings\",\n            \"key\": \"InProc\",\n            \"data\": {\n                \"author\": \"Britn ey Spears\",\n                \"title\": \"Let's Go Oversea To Canada\",\n                \"booktitle\": \"Kiley brown's last word\",\n                \"year\": 2007\n            }\n        }\n    ];\n\nconst bibCode2 = bib.getBibCodeFromObject(arr, 3); // format is 3 here (for curley braced representaion)\nconsole.log(bibCode2);\n\n/*\n    @Book{michael,\n        author = {Michael Jackson},\n        title = {My Kingdom For A Lollypop},\n        publisher = {Neverland \\\u0026 Everland Publishing},\n        year = {2004}\n    }\n\n    @techreport{techReportKey,\n        author = {Elvis Presley},\n        title = {Turn Me One More Time},\n        institution = {Garry insitute of Badoda},\n        year = {1963}\n    }\n\n    @inproceedings{InProc,\n        author = {Britn ey Spears},\n        title = {Let's Go Oversea To Canada},\n        booktitle = {Kiley brown's last word},\n        year = {2007}\n    }\n*/\n```\n\n\u0026raquo; [Back to top](#top)\n\n\n**Note:** Do not forget to check this page if you're working with Latex, BibTeX etc.\n\n### Reference links\n\n+ [Must read - http://www.bibtex.org/Format/](http://www.bibtex.org/Format/)\n\n+ [http://ctan.imsc.res.in/biblio/bibtex/base/xampl.bib](http://ctan.imsc.res.in/biblio/bibtex/base/xampl.bib)\n\n+ [BibTeX format(MIT) - http://web.mit.edu/rsi/www/pdfs/bibtex-format.pdf](http://web.mit.edu/rsi/www/pdfs/bibtex-format.pdf)\n\n+ [Open source bibliography reference manager - http://www.jabref.org/](http://www.jabref.org/)\n\n+ [https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management](https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management)\n\n+ [http://www.bibtex.org/Using/](http://www.bibtex.org/Using/)\n\n+ [http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article](http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article)\n\n+ [http://help.jabref.org/en/Bibtex](http://help.jabref.org/en/Bibtex)\n\n+ [https://en.wikipedia.org/wiki/BibTeX](https://en.wikipedia.org/wiki/BibTeX)\n\n+ [BibteX - standard templates, https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Standard_templates](https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Standard_templates)\n\n+ [BibTeX examples (Imp.) - http://shelah.logic.at/eindex.html](http://shelah.logic.at/eindex.html)\n\n+ [http://nokyotsu.com/latex/bibtex.html#manual (Imp.)](http://nokyotsu.com/latex/bibtex.html#manual)\n\n+ [All supported Entry types \u0026 Entry fields - https://www.sharelatex.com/learn/latex/Bibliography_management_in_LaTeX](https://www.sharelatex.com/learn/latex/Bibliography_management_in_LaTeX)\n\n+ [Citing and referencing in LaTeX - using BibTeX (pdf)](https://gitlab.com/hygull/tech-pdfs/blob/master/latex/bibtex/Citing-And-References-in-LaTeX-BibTeX.pdf)\n\n+ [Preparing Bibliographies using BIBTEX (Imp pdf)](https://gitlab.com/hygull/tech-pdfs/blob/master/latex/bibtex/Preparing-Bibliographies-using-BIBTEX.pdf)\n\n+ [http://www.bibtexsearch.com/](http://www.bibtexsearch.com/) - Visit and search for **bibtex**, **misc**, **article** etc. and you will see excellent examples related to bib.\n\n+ [https://fileinfo.com/extension/bibtex](https://fileinfo.com/extension/bibtex)\n\n+ [https://verbosus.com/bibtex-style-examples.html?lang=en](https://verbosus.com/bibtex-style-examples.html?lang=en)\n\n+ Producing a document with bibliography - [https://www.stat.berkeley.edu/~spector/bibtex.pdf](https://www.stat.berkeley.edu/~spector/bibtex.pdf)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhygull%2Fbibtex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhygull%2Fbibtex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhygull%2Fbibtex/lists"}