This forum is read-only - Please use our new Citavi Forum instead.
Dieses Forum dient nur zur Recherche - Bitte nutzen Sie das neue Citavi Forum für Ihre Fragen.

Is it possible to create custom reference type? Topic is solved

Ask questions about selecting and using citation styles.

Is it possible to create custom reference type?

Postby Vlad » 2013-10-19 21:05

There is only one "Journal Article" reference type in Citavi. However, for publications in Russian, articles published in russian language should be cited differently from those published in english. Is it possible to create a custom reference type, for example "Journal Article - Russian" to be able to differentiate these two types of citations?
Vlad
 

Re: Is it possible to create custom reference type?

Postby Jennifer Schultz » 2013-10-21 08:26

Dear Vlad,

Thanks for your question! Although it is not possible to create a custom reference type, you can make a change to your citation style so that Russian-language articles are cited differently from those published in English.

To do this, on the Reference tab enter "Russian" in the Language field for each Russian-language journal article. If you don't see the Language field, click More fields and then select the checkbox next to the Language field to display it.

Next, open your citation style in the Citation Style Editor. Switch to the Journal article reference type and click in the Default template under Rule set: Bibliography. Then click Template > New. Click Programmed custom conditions available in current citation style > Program a custom condition. Delete the code you see and paste the following code in the window:
Code: Select all
using System.Linq;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;
using SwissAcademic.Collections;

namespace SwissAcademic.Citavi.Citations
{
   public class CustomTemplateCondition
      :
      ITemplateConditionMacro
   {
      public bool IsTemplateForReference(ConditionalTemplate template, Citation citation)
      {
         if (citation == null) return false;
         if (citation.Reference == null) return false;
         
         return citation.Reference.Language.ToLower().StartsWith("Russian");
      }
   }
}


In the Name field enter a name for the condition. Click Compile and make sure no error messages appear in the lower part of the window. Then click Save. Select the checkbox next to the new condition, and then click OK. You now can drag components from the list of components to the template to reflect how you want the citations for Russian-language articles to appear in the bibliography. For more on components, see the following chapter in our manual:
http://www.citavi.com/sub/manual4/en/cs ... nents.html

Last but not least: please don't forget to save your changes by clicking File > Save.

Please just let us know if you have additional questions!

Best regards,
Jennifer
Jennifer Schultz
Citavi Customer Service
 

Re: Is it possible to create custom reference type?

Postby jayjaymal » 2014-07-27 11:22

Hi, I'm hoping to do something similar to what is suggested here. I want to format statutes that are not from my home jurisdiction differently in the bibliography. So I would have a different template for statutes that have a "Legislature / Authority" of "New Zealand".

I had a look at the code below and tried to modify it to work how I wanted, but I could not find the correct field for Legislature. It looked like it used the "Organizations" field, but I cannot use citation.Reference.Organizations. The closest was the getOrganizations, but I couldn't immediately see how to use this to pull a single text string to compare.

Is it possible to do what I want to do?

p.s., I thought about using a custom field but am trying not to do this if possible.
jayjaymal
 

Re: Is it possible to create custom reference type?  Topic is solved

Postby Jennifer Schultz » 2014-07-28 11:58

Hallo jayjaymal,

bitte verwenden Sie dafür den folgenden Code:
Code: Select all
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using SwissAcademic.Citavi;
using SwissAcademic.Citavi.Metadata;
using SwissAcademic.Collections;

namespace SwissAcademic.Citavi.Citations
{
   public class CustomTemplateCondition
      :
      ITemplateConditionMacro
   {
      public bool IsTemplateForReference(ConditionalTemplate template, Citation citation)
      {
         //Name: Check if field Legislature / Authority contains New Zealand
         
         if (citation == null) return false;
         if (citation.Reference == null) return false;
         if (citation.Reference.ReferenceType != ReferenceType.StatuteOrRegulation) return false;
         
         var legislatures = citation.Reference.GetOrganizations();
         if (legislatures == null || legislatures.Count == 0) return false;
         
         //"New Zealand"
         var wordList = new string[] {
            "New Zealand"
         };
         
         var regEx = new Regex(@"\b(" + string.Join("|", wordList) + @")\b", RegexOptions.IgnoreCase);
         return legislatures.Any<IPerson>(legislature => regEx.IsMatch(legislature.LastName) || regEx.IsMatch(legislature.Abbreviation));
   
      }
   }
}


Wenn Sie noch Fragen oder Schwierigkeiten haben, zögern Sie bitte nicht, sich nochmals zu melden!

Freundliche Grüsse
Jennifer Schultz
Jennifer Schultz
Citavi Customer Service
 

Re: Is it possible to create custom reference type?

Postby jayjaymal » 2014-07-30 02:56

Danke Jennifer! Das funktioniert perfekt :-)
jayjaymal
 


Return to General Questions