LaTex / Bibtex – Bar54 http://www.bar54.de Software Engineering, Web Technologies, eCommerce and some more Wed, 29 Oct 2014 16:13:14 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.4 TeXnicCenter Custom Text Modules http://www.bar54.de/2014/07/texniccenter-custom-text-modules/ Sun, 13 Jul 2014 16:07:34 +0000 http://www.bar54.de/?p=748 Writing an artical or book with latex, you typically use similar commands over and over again. For example, when you use a glossary, you might use the \gls{SPL} to refer the acronym SPL for a Software Product Line. Typing all the characters is tedious and boaring.
TeXnixCenter provides a feature called “Own Text Modules” to specify customer text modules simply to be reused with a key combination.

To specify a text module, use the main menu “Insert > Own Text Modules > Manage Text Modules“.
own-text-modules-menu

In the dialog, create a new text module and specify the text to be placed before and after the current curser position in the document.
own-text-modules-dialog

 
Finally, when you confirm the dialog, the new text module is added to the “Insert > Own Text Modules” menu.
In my daily work, I got used to the short cut “ALT + I + M + (x)” where (x) is the number in front of your own text module within the menu.

Give it a try, the keys are located on the keyboard that you get used to in a short time (at least I did).

]]>
Latex Reducing Enumeration Item Space http://www.bar54.de/2014/05/latex-reducing-enumeration-item-space/ Sun, 04 May 2014 20:03:20 +0000 http://www.bar54.de/?p=713 The default enumeration item spacing in most LaTeX styles is quite generous. If you want to save some space and provide an often more compact presentation to your reader, different approaches are available.

Starting with a default presentation, this article presents alternatives to improve the listing.

\begin{enumerate}
\item Item One
\item Item Two
\item Item Three
\end{enumerate}

Using Paralist Package

Using the paralist package you can use the new enumeration style compactenum:

\usepackage{paralist}
...
\begin{compactenum}
\item Item One
\item Item Two
\item Item Three
\end{compactenum}

compactenum automatically reduces the line height of your listing and applies a more contact presentation.

Using itemsep Declaration

The default enumaration and itemize environments allow for specifiying an itesep declaration to configure the items’ line height characterstics. This solution does not require any specific package to be used, but to manually specify the line-height.

\begin{enumerate}
\itemsep-2pt
\item Item One
\item Item Two
\item Item Three
\end{enumerate}
]]>
Mendeley and Latex / Bibtex http://www.bar54.de/2014/02/mendeley-and-latex-bibtex/ Wed, 12 Feb 2014 14:38:04 +0000 http://www.bar54.de/?p=620

Table Of Content

Mendeley is a really good literature management tool. Especially, if you are writing magazin articles or research papers in frequent manner. Beside the web portal, it also provides deskop, smartphone and tablet clients and allows for collaboration with you]]> 1 Introduction

Mendeley is a really good literature management tool. Especially, if you are writing magazin articles or research papers in frequent manner. Beside the web portal, it also provides deskop, smartphone and tablet clients and allows for collaboration with you co-authers.

However, the integration with latex, respectively bibtex is still very young and you need to tweek some stuff or use workarounds for a really smooth integration. The key for this smooth integration is the bibtext backend biber. It allows for pre-processing the bib-file entries before they are processed by latex.

2 Biber Setup

TexnicCenter Biber Configuration
TexnicCenter Biber Configuration
First you should install biber in your local latex installation. I use Miktex installed to C:\Program Files (x86)\MiKTeX 2.9. If not already installed, download biber from http://biblatex-biber.sourceforge.net/ and place the biber.exe in C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.
Furthermore, I use TexnicCenter for writing Latex. There you can copy the default output profile “LaTeX -> PDF” and rename it to “LaTeX -> PDF (Biber)”. Set the “path” to BibTeX to point to your biber.exe file.
Next, you should configure biber as biblatex backend in your main LaTeX file. Your usepackage definition for biblatex must look similar to

\usepackage[citestyle=numeric,style=numeric,backend=biber]{biblatex}

Finally, you can choose to either use a biber.conf file for your biber configurations, or include your configuration directly in your LaTeX document. I personally prefer the external configuration file to not mess-up the content of my document and because normally I have further biber configurations as well.

3 Filter Fields

Mendeley does not provide a configuration/mapping which of an entry’s fields to export and what target Bibtex fields to export to. It always exports the same standard fields into an bib file. While some of these fields are not needed and sometimes contain error prone characters (e.g. ‘{‘ or ‘}’), others must be stored into fields with different names to be processed by Bibtex in the intended manner.

To handle this issue, you can use biber to prepare the bib file entries for further processing by latex / bibtex. This configuration can be done either in the separate biber.conf file or directly in your LaTeX document. It is important to place the biber.conf file beside your main tex file to be sure it is found by the biber tooling.

3.1 External biber.conf File

If not yet done, create a file named biber.conf in the main directory of your project. If you want to filter your personal notes written to mendeley entries and the references’ abstracts from the bib entries, you must filter the fields named “annote” and “abstract”. Note: The field names are mendeley specific in the bib file. In your Latex bbl file, you might see a \field{annotation}. This is the final result from bibtext processing. While the biber processing is performed in advance, you must use the field names of the original bib file.

So to filter annote and abstract fields, you should place the following XML configurations in the biber.conf file:

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <sourcemap>
    <maps datatype="bibtex" map_overwrite="1">
      <map>
        <map_step map_field_set="annote" map_null="1"/>
        <map_step map_field_set="abstract" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
</config>

Due to biber’s configuration lookup strategy, it automatically processes the biber.conf file’s content, if it is placed beside the latex main file.
Note: Biber supports different locations and scopes to place your configuration in. Please refer to the Biber documentation find out more about the other possibilities.

3.2 In-Document Configuration

If you do not want to have an extra file in your project, you can configure the biber mapping with latex commands right in your latex document.

Placing the following commands below your bibliography reference (and before the document ist started), this will have the same effect as the external XML configuration shown above:

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \step[fieldset=annote, null]
      \step[fieldset=abstract, null]
    }
  }
}

4 URL vs. Howpublished Fields

Depending on the bibliography style required, the style supports the “url” field, the “howpublished” field, or both. Typically, you use your mendeley entries for different types of publications with different bibliography styles. One option would be to always maintain the “Medium” and the “URL” fields in parallel, because “Medium” is exported into “howpublished”. Depending on the particular style of the publication, you could use a field filter as described above to keep the required one only. However, this redundancy is quite unsatisfying in terms of effort and error-proneness.
A better solution is to maintain only one field (url might be the more obvious and activated by default in mendeley), and configure a biber mapping depending on what you need.

The following mapping configuration is able to map the “url” field into the “howpublished” if this is not filled already.

<map map_overwrite="0">
  <map_step map_field_source="url"/>
  <map_step map_field_set="howpublished" map_origfieldval="1"/>
</map>

You should place it inside the

<maps ...>...</maps>

tags.

4.1 References

Further information can be found at:

]]>
Mendeley: Webpage Entry URLs in Bibtex Export http://www.bar54.de/2013/10/mendeley-webpage-entry-urls-in-bibtex-export/ http://www.bar54.de/2013/10/mendeley-webpage-entry-urls-in-bibtex-export/#respond Sat, 19 Oct 2013 05:13:09 +0000 http://www.bar54.de/blog/?p=503 Note: There is a newer blog post providing more recent hints for integration: Mendeley and LaTeX / BibTeX

Mendeley is very good literature reference management software and provides a good export for Bibtex reference files. However, some interactions between those tools does not work out-of-the-box.

Mendeley allows for managing Webpage entries. Those are exported to @misc entries in the Bibtex file. While managing a URL field in Mendeley, the resuting url = http://… field in the @misc-entry is not included in the processed LaTex document referencing the according entry.

But this can be fixed. @misc-entries support a field named “howpublished”. This field does not exist in Mendeley’s field schema. But there is a field in Mendeley called “Medium” to put in the “medium in which the publication has been published”. So as you might guess, the value of this field is exported into Bibtex’s “howpublished”-field.

1. activate the Medium-field for webpage entries in the tool options:

image

(Tools > Options > Document Details)

2. Put the webpage’s Url in the medium-field
image

3. Export your Bibtex file and render the document.

That’s all. You will get your webpage url presented on the generated document.

]]>
http://www.bar54.de/2013/10/mendeley-webpage-entry-urls-in-bibtex-export/feed/ 0