Harvard Anglia Issues

Sep 24, 2009 at 8:12 PM

Hi Yves,

From a previous discussion, I downloaded the special Harvard Anglia that sorts the dates from newest to oldest you had posted here (http://allserv.ugent.be/~ydhondt) and it did indeed solve the reverse order perfectly, thank you.

I was also trying to run the BibWord Extender tool to add letter suffixes to the years in which I had the same author multiple times within a year. It kept giving me error messages. You had advised me:

"It sounds as if you don't have the .Net framework 3.5 (which contains WindowsBase.dll) installed. See the requirements section at http://bibword.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24823"

I did download and install the .Net framework 3.5, and that solved part of the problem - no more error messages. Now I close my Word document with the bibliography in it, run the BibWord extender tool (version 2.0), and it tells me it's been extended. However, when I re-open the document, there are no extensions. I am using Word 2007 on a PC. I tried updating the fields, tried switching to a different style then back again, didn't work.

My source type is report, and I am using the corporate author field.

In addition, is there any way I can change my in-text citations to be a short version of the author name? For instance the bibliography entry is "Long Company Name. 2006" and I want it to show in the citation as "LCN 2006" - I have tried editing the citation field, but it only has options to suppress things, and I can't type over the existing text, either. If I use a different field to enter that short author info, is there somewhere for me to change the field the citation uses to pull text?

Any help would be appreciated.

Coordinator
Sep 24, 2009 at 9:30 PM

The BibWord Extender tool only extends the internals. When you then open your document again in Word, selecting your style again from the drop down list should update all citation and bibliography fields. If it doesn't work directly, try switching to another style and back.

If you still don't see any year suffices, you can manually check if BibWord Extender completed its task successfully. Create a copy of your docx file and change the extension from docx to zip. Open the zip archive. Look in the customXml directory for a file called item1.xml (name could be different, but its very unlikely). In it, you will find all your sources. Check if you find a BibOrder tag (<BibOrder>). If not, then there was no extension. If there is one, then there was an extension. If it is empty while it shouldn't be, chances are your formatting rules do not define matches which require a suffix. At first glance, it doesn't seem anything is wrong with the formatting rules, but you might want to verify them anyway.

 

 

You can not directly switch to a short version as Word has no idea as to what a short version of your name would be. However, there is a workaround. You can add a prefix to any citation using the /f flag in Word. That in combination with suppressing the authors should do the trick for you.

Right click on your in-text citation and select "Edit field...". A dialog will popup with on the right a string looking like:

CITATION Bou022 \l 1033

In the above example Bou022 is the tag of the source while 1033 is the language used. So both could be different on your machine. What you want to do is first suppress the author by adding the \n switch and then adding a prefix using the \f switch. So you would get:

CITATION Bou022 \n \f "LCN" \l 1033

Note that if you always want to use that short version with corporate authors, you could write a short abbreviation routine in the XSLT (or try reusing the one there is for name) and add it as an extra option. Look for the comment line "<!-- Format the corporate parameter. -->" to get an idea as to where to define your option. Currently, "u" (uppercase) and "l" (lowercase) are defined, but you could add an "a" for abbreviated for example. But remember, it will then be used for all citations. There is no automated way to tell that the first time a citation should be in full and abbreviated in all following cases.

 

Sep 25, 2009 at 1:36 AM

I followed your directions above regarding saving it as a zip file and checking the file called item1.xml. There was no BibOrder anywhere in the file.  How can I change the formatting rules to define matches which require a suffix?

I see your point about Word having no idea what the short version should be. Your "edit field" instruction worked perfectly. That will get me by, and is much better off than I was. However, it is true that I will always want to use the short form for in-text citations. I found the code for "format the corporate parameter", but I can't figure out which portion of the code thereafter is for name - I see "u" for uppercase and "l" for lowercase...I am clueless...is it something in here I need to edit:

- <!--
 Abbreviate a name (or part of a name if called recursively). 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
- <xsl:template name="abbreviate-name">
- <!--
 Name or part of name to abbreviate. 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
  <xsl:param name="name" />
- <!--
 Flag indicating if abbreviated parts should be followed by a period (1) or not (0). 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
  <xsl:param name="withPeriods" select="1" />
- <!--
 Flag indicating if spaces between abbreviated parts should be kept (1) or not (0). 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
  <xsl:param name="keepSpaces" select="1" />
- <!--
 Flag indicating if dashes between abbreviated parts should be kept (1) or not (0). 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
  <xsl:param name="keepDashes" select="1" />
- <xsl:choose>
- <!--
 Handle 'A-B' 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
- <xsl:when test="contains($name, '-')">
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-before(normalize-space($name), '-')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
- <xsl:if test="$keepDashes = 1">
  <xsl:text>-</xsl:text>
  </xsl:if>
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-after(normalize-space($name), '-')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
  </xsl:when>
- <!--
 Handle 'A B' 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
- <xsl:when test="contains($name, ' ')">
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-before(normalize-space($name), ' ')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
- <xsl:if test="$keepSpaces = 1">
  <xsl:text />
  </xsl:if>
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-after(normalize-space($name), ' ')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
  </xsl:when>
- <!--
 Handle 'A.B.'
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
- <xsl:when test="contains($name, '.') and string-length(substring-after($name, '.')) > 0">
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-before(normalize-space($name), '.')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
- <xsl:if test="$keepSpaces = 1">
  <xsl:text />
  </xsl:if>
- <xsl:call-template name="abbreviate-name">
  <xsl:with-param name="name" select="substring-after(normalize-space($name), '.')" />
  <xsl:with-param name="withPeriods" select="$withPeriods" />
  <xsl:with-param name="keepSpaces" select="$keepSpaces" />
  <xsl:with-param name="keepDashes" select="$keepDashes" />
  </xsl:call-template>
  </xsl:when>
- <xsl:otherwise>
- <xsl:if test="string-length($name) > 0">
  <xsl:value-of select="substring($name,1,1)" />
- <xsl:if test="$withPeriods = 1">
  <xsl:text>.</xsl:text>
  </xsl:if>
  </xsl:if>
  </xsl:otherwise>
  </xsl:choose>
  </xsl:template>
- <!--
 Abbreviates a string to its capital letters only. 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
- <xsl:template name="abbreviate-to-capitals">
- <!--
 String to abbreviate. 
  --> <script type="text/javascript">// <![CDATA[ f(clean); // ]]></script>
  <xsl:param name="string" />

 

Coordinator
Sep 25, 2009 at 6:52 AM

I tested it with that specific style and I did get year suffices. Are you sure the names are exactly the same? For example "United Nations" is not the same as "united nations". If you still have a problem, mail me a small piece of text containing about 5 citations of which 2-3 should have a year suffix together with your stylesheet so I can look into it (probably won't be in the first few days). My email can normally be found at the top of your stylesheet.

Where the corporate element is formatted, you currently have 2 options: uppercase and lowercase

 <!-- Format the corporate parameter. -->
<xsl:choose>
  <xsl:when test="contains($options, 'u')">
    <xsl:call-template name="upper-case">
      <xsl:with-param name="string" select="$corporate"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:when test="contains($options, 'l')">
    <xsl:call-template name="lower-case">
      <xsl:with-param name="string" select="$corporate"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="$corporate"/>
  </xsl:otherwise>
</xsl:choose>

What you could do is add a third option 'a' which acts similar to the abbreviation of name parts:

<!-- Format the corporate parameter. -->
<xsl:choose>
  <xsl:when test="contains($options, 'u')">
    <xsl:call-template name="upper-case">
      <xsl:with-param name="string" select="$corporate"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:when test="contains($options, 'l')">
    <xsl:call-template name="lower-case">
      <xsl:with-param name="string" select="$corporate"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:when test="contains($options, 'a')">
    <xsl:call-template name="abbreviate-name">
      <xsl:with-param name="name" select="$corporate"/>
      <xsl:with-param name="keepDashes">
        <xsl:choose>
          <xsl:when test="contains($options, 'd')">
            <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>0</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="withPeriods">
        <xsl:choose>
          <xsl:when test="contains($options, 'p')">
            <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>0</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="keepSpaces">
        <xsl:choose>
          <xsl:when test="contains($options, 's')">
            <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>0</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="$corporate"/>
  </xsl:otherwise>
</xsl:choose>

So then, you can change the format string for corporate authors in the namelist from:

<corporate>{%Corporate%}</corporate>

into

<corporate>{%Corporate:a%}</corporate>

That way, all corporate names will be abbreviated without spaces (s), dashes (d), or periods (p).

Oct 6, 2009 at 11:44 PM

Somehow, the year suffices are now miraculously working, I don't know what changed. However, this has revealed yet another issue.

I successfully changed the sort order for source type report:

<source type="Report">
        <column id="1">
          <halign>left</halign>
          <valign>top</valign>
          <format>{ %ThesisType%}{ %Author:2|"Anon."%}.}{ %Year|"n.d."%{%YearSuffix%}.}{ &lt;i&gt;%Title|ShortTitle%&lt;/i&gt;.}{ %City|CountryRegion%{, %CountryRegion%}{: %Publisher|Institution%}}{ %Publisher|Institution%}.{ %StandardNumber%.}.{ %Comments%.}{ %Month%}.}</format>
        </column>
        <sortkey>{%Author:0|"Anon."%}{%Year|"n.d."%}{%Month%}{%Title:a|ShortTitle:a%}</sortkey>

I thought it was perfect, but it is perceiving the month field as an alphabetical sort, not numerical, so my output is like this:

Client Name. 2006a. The Geology of the Eastern Part of Client Name. SLAC-I-750-3A33X-001. February.
Client Name. 2006b. More Testing for Same Author in Same Year. November.
Client Name. 2006c. Testing a Document for Multiple Documents by Same Author within Same Year. SLAC-XX-Test. October.

Where "F" comes before "N", and "N" comes before "O," instead of February, October, November.

How can I assign a numerical value to the months? I thought this bit of code already did that:

</list>
    </namelists>
    <strings>
      <months>
        <month number="1">January</month>
        <month number="2">February</month>
        <month number="3">March</month>
        <month number="4">April</month>
        <month number="5">May</month>
        <month number="6">June</month>
        <month number="7">July</month>
        <month number="8">Augustus</month>
        <month number="9">September</month>
        <month number="10">October</month>
        <month number="11">November</month>
        <month number="12">December</month>
      </months>
    </strings>

What am I missing?

 

Coordinator
Oct 7, 2009 at 8:47 AM

That last bit of code is actually meant for the opposite action: if the month is represented by a number, then this part can translate the number into a string. The other way around would be a lot harder to achieve as the stylesheet would only be able to guess in what language you entered a month's name and if it was abbreviated or not. Note that numbers get only translated to strings if the s option is activated ( %Month:s% )

But even if you entered the month as a number (something which you should do), there is still an issue with sorting. The sortkey which is generated is a string, meaning that no part of it is sorted as a numeral. So "2006 12" would be before "2006 3". The solution to that would be to ensure that a month is always represented by 2 digits. There currently is no such functionality build into BibWord. There is such functionality for Days (the n option). So it should be easy to see how it is done in the format-day template and use that information to extend the format-month template. It is actually a good idea to have such formatting option so I'll probably add it to the next BibWord release.