I produce a bibliography with pandoc from a bibtex file. In my bibtex entries I have the location of the pdf (not an url, just a file reference in a field file). I would like to include this reference in the bibliography, but do not see how to extend the chicago-author-date.csl - I am completely new to CSL...
I assume I have to add something like
<text macro="file" prefix=". "/>
in the layout section. But how to define the macro? How is the connection between the bibtex field and the CSL achieved?
Is there somewhere a "how to" page?
Thank you for help!
An example bibtex entry is:
author = {Frank, Andrew U.},
title = {Geo-Ontologies Are Scale Dependent (abstract only)},
booktitle = {European Geosciences Union, General Assembly 2009, Session Knowledge and Ontologies},
year = {2009},
editor = {Pulkkinen, Tuija},
url = {http://publik.tuwien.ac.at/files/PubDat-175453.pdf},
file = {docs/docs4/4698_GeoOntologies_abstarct_EUG_09.pdf},
keywords = {Onto},
owner = {frank},
timestamp = {2018.11.29},
}
the file entry should be inserted in the output as a relative web reference (clickable) - in addition to the usual output from the chicago-author-data style.
I add a list of nocite to the markdown text (read in from file) and process it (in Haskell) with the API
res <- processCites' markdownText
It works ok, I miss only the file value.
Related
The default way of displaying references with Quarto documents seems to put author names in this format: Last1, First1, First2 Last2, First3 Last3, and First4 Last4. So the first author name is displayed differently than the rest. Is that intentional and is there a way to change that?
Here's an example:
---
project:
type: website
format: html
bibliography: references.bib
---
## Text
#bibitem1
Content of references.bib
#article{bibitem1,
author = {First1 Last1 and First2 Last2 and First3 Last3 and First4 Last4},
title = {Article title},
journal = {Journal name},
year = {2013},
volume = {3},
number = {72},
pages = {14--18}
}
which is displayed as
Last1, First1, First2 Last2, First3 Last3, and First4 Last4. 2013. “Article Title.” Journal Name 3 (72): 14–18.
How your references are displayed is entirely determined by the bibliography format you use. Quarto adopts a default one. You can specify a custom one with the csl option, specified in your YAML header as for example:
csl: biomed-central.csl
Styles for many journals are available with the Zotero project: https://www.zotero.org/styles
These styles are composed using the Citation Style Language. In principle, you could customize such a style (including the default style used by Quarto). It is not that trivial, though, and would require some effort to understand and use the language.
I am getting form fields from the PDF document but I did not see any method for getting form field format ForExample there are multiple text form fields in my document including Number field, Date field, Percentage field.
Is there any way to get field format type in itext7
#Uladzimir Asipchuk
/TU dictionary contains ToolTip value. Format value is contained in /AA >> /K dictionary in PDF structure. However I have extracted the JS Method after some tries and exploring the PDF structure through Pre-Flight. The following code snippet give the associated JSMethod if any:
PdfDictionary additionalActions = formField.GetAdditionalAction();
if (additionalActions != null)
{
PdfDictionary formatDictionary = additionalActions.GetAsDictionary(PdfName.K);
PdfString jsMethod = formatDictionary.GetAsString(PdfName.JS);
string fieldJsMethod = jsMethod.GetValue();
}
I created a pdf via Adobe (as you suggested) and I indeed was able to set the "format" of a text field as Date, Number, Percentage, Email,..
Then I opened the resultant pdf in RUPS (an utility program used to open the pdf's tree) and investigated it.
It turned out that Adobe sets the "format" which you want to get as a /TU value of the field's dictionary. For example, for Percentage it's percentfield and for Email - emailfield.
Now the only thing you need to find the "format" of your fieeld is to get the value of /TU entry of your field:
field.getValue().getPdfObject().get(PdfName.TU)
Is there a way within a praatscript to query the path and filename of an object.
I want to save a textgrid to the same file I opened (overwite it)
I was think of something like:
selectObject: n
type_name$ = selected$ ()
file_name$ = some_way_to_query_this..., n
type$ = extractWord$ (type_name$, "")
if type$ == "TextGrid"
runScript: "save.praat", file_name$
endif
No. Objects in Praat do not store information about their location on disk because most objects will never exist on disk at all. Objects are not files.
If you are reading an object from a file, and then want to store the object to the same location, then you should store that information elsewhere yourself.
This isn't an answer to your question but to the situation. Depending on how you open the textgrid, you could throw the filename into a string variable and then save to the same name.
file$ = "C:\Users\Me\Desktop\praat\example.TextGrid"
Read from file: file$
Set tier name: 1, "this"
Set tier name: 2, "that"
Save as text file: file$
This answer is quite late but it could be still useful to someone...
The file name, if it exists, can be shown with the Info command.
After selecting an object:
object_info$ = Info
file_name$ = extractLine$(object_info$, "Associated file: ")
writeInfo: file_name$
How to read the details of particular sections using c#...
i am new to c# and i have to read the details from a text file based on the sections marked between square brackets "[]".. the file looks like
[Header]
This is the header info for the file
[Body]
This is the body information for the provided file
and it contains many information for the file
[Summary]
Summary for the file.
i need to read each of these sections details (eg. [Header], [Body])..
any help in this direction is highly appreciated...
Assuming the text between those headers does not contain brackets you can do it this way:
Dictionary<String,String> content = new Dictionary<String,String>();
String text = #"[Header]
This is the header info for the file
[Body]This is the body information for the provided file and it contains many information for the file
[Summary]Summary for the file.";
foreach (String section in text.Split("[".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
{
String[] sectionParts = section.Split(']');
content.Add(sectionParts[0], sectionParts[1]);
}
The Dictionary will contain the content of your File as header-text-pairs
I'm having some trouble with reading out the IPTC data of some images, the reason why I want to do this, is because my client has all the keywords already in the IPTC data and doesn't want to re-enter them on the site.
So I created this simple script to read them out:
$size = getimagesize($image, $info);
if(isset($info['APP13'])) {
$iptc = iptcparse($info['APP13']);
print '<pre>';
var_dump($iptc['2#025']);
print '</pre>';
}
This works perfectly in most cases, but it's having trouble with some images.
Notice: Undefined index: 2#025
While I can clearly see the keywords in photoshop.
Are there any decent small libraries that could read the keywords in every image? Or am I doing something wrong here?
I've seen a lot of weird IPTC problems. Could be that you have 2 APP13 segments. I noticed that, for some reasons, some JPEGs have multiple IPTC blocks. It's possibly the problem with using several photo-editing programs or some manual file manipulation.
Could be that PHP is trying to read the empty APP13 or even embedded "thumbnail metadata".
Could be also problem with segments lenght - APP13 or 8BIM have lenght marker bytes that might have wrong values.
Try HEX editor and check the file "manually".
I have found that IPTC is almost always embedded as xml using the XMP format, and is often not in the APP13 slot. You can sometimes get the IPTC info by using iptcparse($info['APP1']), but the most reliable way to get it without a third party library is to simply search through the image file from the relevant xml string (I got this from another answer, but I haven't been able to find it, otherwise I would link!):
The xml for the keywords always has the form "<dc:subject>...<rdf:Seq><rdf:li>Keyword 1</rdf:li><rdf:li>Keyword 2</rdf:li>...<rdf:li>Keyword N</rdf:li></rdf:Seq>...</dc:subject>"
So you can just get the file as a string using file_get_contents(get_attached_file($attachment_id)), use strpos() to find each opening (<rdf:li>) and closing (</rdf:li>) XML tag, and grab the keyword between them using substr().
The following snippet works for all jpegs I have tested it on. It will fill the array $keys with IPTC tags taken from an image on wordpress with id $attachment_id:
$content = file_get_contents(get_attached_file($attachment_id));
// Look for xmp data: xml tag "dc:subject" is where keywords are stored
$xmp_data_start = strpos($content, '<dc:subject>') + 12;
// Only proceed if able to find dc:subject tag
if ($xmp_data_start != FALSE) {
$xmp_data_end = strpos($content, '</dc:subject>');
$xmp_data_length = $xmp_data_end - $xmp_data_start;
$xmp_data = substr($content, $xmp_data_start, $xmp_data_length);
// Look for tag "rdf:Seq" where individual keywords are listed
$key_data_start = strpos($xmp_data, '<rdf:Seq>') + 9;
// Only proceed if able to find rdf:Seq tag
if ($key_data_start != FALSE) {
$key_data_end = strpos($xmp_data, '</rdf:Seq>');
$key_data_length = $key_data_end - $key_data_start;
$key_data = substr($xmp_data, $key_data_start, $key_data_length);
// $ctr will track position of each <rdf:li> tag, starting with first
$ctr = strpos($key_data, '<rdf:li>');
// Initialize empty array to store keywords
$keys = Array();
// While loop stores each keyword and searches for next xml keyword tag
while($ctr != FALSE && $ctr < $key_data_length) {
// Skip past the tag to get the keyword itself
$key_begin = $ctr + 8;
// Keyword ends where closing tag begins
$key_end = strpos($key_data, '</rdf:li>', $key_begin);
// Make sure keyword has a closing tag
if ($key_end == FALSE) break;
// Make sure keyword is not too long (not sure what WP can handle)
$key_length = $key_end - $key_begin;
$key_length = (100 < $key_length ? 100 : $key_length);
// Add keyword to keyword array
array_push($keys, substr($key_data, $key_begin, $key_length));
// Find next keyword open tag
$ctr = strpos($key_data, '<rdf:li>', $key_end);
}
}
}
I have this implemented in a plugin to put IPTC keywords into WP's "Description" field, which you can find here.
ExifTool is very robust if you can shell out to that (from PHP it looks like?)