1

I was wondering if there is a way to make a command to generate a BibLatex blank entry to be filled easily (instead of typing all the fields I need).

Context to what I am thinking:

I know JabRef and Zotero (the ones I use) produces the sort of entries according to the config./style I need, but, imagine that I just want to create my bibliog. entries directly in a .bib file. So, instead of writing:

@book{  ,
  author = ,
  title  = ,
  location = ,
  etc ...,
  }

I could type, for example, \book -- into a .bib file -- and then generate the type of entry (book, article, inbook, etc).

If there's a way, please, indicate me the way for achieving that. Ig there's not, thanks anyway.

Thanks.

  • There are many editors with snippet for bibliography out of the box, and there are many more in which you can add custom snippets. So I believe the answer is depend on your editor. – Luis Turcio Mar 27 '23 at 01:10
  • @LuisTurcio, that's my point: I do not want to use editors, but directly make my references in a .bib file. – D.ClassMemoir Mar 27 '23 at 01:25
  • 1
    I'm confused. biblatex (and friends) will transform a .bib file into a new file. But they won't change the contents of a file. So if you type \book, it will stay \book. You could ask for a tex command that would transform \book{key,author=DCM...} into a .bib entry, but you might as well skip that step and type it as @book{key,author=DCM...} in the first place. So we're back to something that would generate @book{...} for you within the file. And that's the job of the editor that you're using, be it Notepad or Word (and you are using an editor). So: which editor? – Teepeemm Mar 27 '23 at 01:44
  • @D.ClassMemoir I was thinking in text editors, like visual studio code, sublime, atom, etc. not “bib editors” like zotero. In all of them you can write in a bib file and use the snippets of the corresponding text editor to obtain exactly what yo ask. What do you use to write your tex file? Maybe this information can lead to some kind of answer – Luis Turcio Mar 27 '23 at 01:51
  • Use a spreadsheet, using CONCATENATE and SUBSTITUTE text functions. Input the data (each cell acts as a field template). Concatenate the formatted fields together. The entire .bib file then becomes one copy-paste step from the final spreadsheet column. – Cicada Mar 27 '23 at 13:01
  • @Teepeemm I use Tex Studio, and I already tried its feature (just see as it generate the code for @book: @book{ID, author = {author}, title = {title}, date = {date}, OPTeditor = {editor}, OPTeditora = {editora}, OPTeditorb = {editorb}, OPTeditorc = {editorc}, OPTtranslator = {translator}, OPTannotator = {annotator}, OPTcommentator = {commentator}, OPTintroduction = {introduction}, OPTforeword = {foreword}, ... } Too much information for what I need. I'd have to choose from the list the items I need. – D.ClassMemoir Mar 29 '23 at 17:14
  • @LuisTurcio, how do I achieve this (through snnipets) from within the bib file using TexStudio (see my comment to Teepeemm above, 'cuz TexStudio does generate the entries but too many lines of OPT fields)? – D.ClassMemoir Mar 29 '23 at 17:16
  • @Cicada, cool, but one additional info.: I'm a professor of Linguistics, Literature and Scientific Methodology who, by the way, likes technology. Unfortunately, I do not pass (through my self-taught attempts to learn how to code) the console.log or print(). heheheh. Sorry, I do not know how to concatenate this in a spreadsheet. – D.ClassMemoir Mar 29 '23 at 17:19

3 Answers3

0

This would have to be a feature of the editor you use to create your .bib files. The .bib file syntax is fairly rigid and does not allow for macros and macro definitions in the same way .tex files do (which does not mean that you cannot use macros you have defined in your .tex document in your .bib file, mind).

There are plenty of editors out there (LaTeX Editors/IDEs). Some will have a feature like this built in, others might allow you to install an external add-on/plug-in for the job, for another subset there might be no such function.

Just off the top of my head, the following editors can do this.

moewe
  • 175,683
  • thanks for the links. I'll take a look and see if I can get what I need. – D.ClassMemoir Mar 29 '23 at 17:21
  • 1
    @D.ClassMemoir Note that, according to the link, with TeXstudio, The optional fields can be automatically deleted with the “Clean” command of the “Bibliography” menu. – Cicada Mar 31 '23 at 08:49
0

I don't know about a LaTeX command, but I'd use Ctrl+C, and Ctrl+V.

Write one blank example for each one you'll need (article/book/report etc) either at the top of your .bib file, or put them in a separate .tex file out of the way.

Then copy and paste the correct blank template into your reference list and fill it in each time you add a reference.

  • Note that leaving a dummy entry in the .bib could be problematic. Biber for example will throw an error if it encounters an entry without an entry key (e.g. @article{, ...}). – moewe Mar 27 '23 at 15:55
0

just for the sake of information/update...

Following the documentation of TexStudio (which is the editor I use), I found out the Macros option in the menu. So, I "created" a macro for each of my entries and attributed the shortcut keys provided by TexStudio.

Of course, it is the Normal mode, as TexStudio also offers environment and script options for macro creation, options I don't need.

This way, I just type the shortcut keys into the .bib file and get what I need. See example below:

  • Macro name: book.Bib
  • Shortcut: Ctrl+M,Ctrl+B
  • Macro:
@book{,
        author     = {},
        title      = {},
        edition    = {},
        address    = {},
        publisher  = {},
        year       = {},
        translator = {},
    }

I do hope it helps someone.