GithubHelp home page GithubHelp logo

saldef / ref2tex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sahraoui17/ref2tex

0.0 0.0 0.0 13 KB

A package that converts inline citation (i.e. (Sahraoui et al. 2023), or [1]) to latex cite command: \cite(bibkeyname)

License: MIT License

Python 100.00%

ref2tex's Introduction

ref2tex: Covert Inline Citations to Latex Cite Command

Introduction

Converting inline citations in a Word document to Latex is not an easy task. Even if you have all the references in bibtex, you still need to replace each citation, which requires searching for each reference in the list of bibliography then finding that reference's bibtex entry and getting its key, then finally replacing the citation i.e. [1] to \cite{bibkey}.

This repository contains the code of ref2tex package that automatically converts inline citations (e.g. [1] or (Sahraoui et al. 2023)) to latex cite command (e.g. \cite{refkey2023}).

Input:

  1. File that contains original text with inline citations (.txt or .tex, NOT in .doc or .docx)
  2. Text file that contains list of references (bibliography)
  3. Bibtex file that contains all bib entries of the references listed in bibliography file

Output: The original text where inline citations are replaced with \cite commands

Supported styles

The following styles are supported:

  • APA (which uses (AuthorName Year) format)
  • IEEE (which uses ([number]) format)

If your source documents is in difference style, converting it to APA or IEEE styles should be straightforward using reference management software such as Mendeley or Endnote.

Usage

You can directly run the script corresponding to the source citation style, for example, if the source document is using APA style:

python ieee2tex.py -i sourceFile -r refsFile -b bibtexFile [-o OutputFile]

-i input file that contains orginal text with inline citations (e.g. [1] for IEEE or (Sahraoui et al. 2023) for APA)
-r txt file that contains a list of references (bibliography)
-b bib file that contains all bib entries of the references listed in bibliography file
-o [optional] the output tex file that will contain the converted inline citations (e.g. \cite{keyX2023}). If not specified, the output file is named output_cited.tex

Example:

python ieee2tex.py -i myFile.tex -r myRefs.txt -b mybib.bib

Instalation

pip install ref2tex
import ref2tex.ieee2tex as ieee2tex
ieee2tex.ieee2tex('inputRefs.txt','inputFile.tex','bibFile.bib','my_out_file.tex')

Ongoing improvements

  • bibtex entry generation, in case it is missing in the provided bibtex library.
  • Deep learning based reference identification (author,year,journal/conference ...etc.) rather than parsing
  • provide a web-based service for online citation converting

Licence

Licensed under the MIT license.

ref2tex's People

Contributors

sahraoui17 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.