Automatically abbreviate authors' first names in LaTeX - latex

Using natbib/Latex/Bibtex, in the references section I get references with full first names like:
Vladimir Iosifovich Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. Technical Report 8, 1966.
I would like automatically abbreviated first names like:
V. I. Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. Technical Report 8, 1966.
If you have an idea how to do this I will be glad to hear.

Use a BibTeX style that does this. Alternatively, create your own style by modifying an existing one. You will have to change the function format.names, so that a line similar to this:
s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
has f. as shown. The full first name would be shown if it is ff.

If you are using Biblatex, just add this in your preable when calling for Biblatex:
\usepackage[backend=bibtex,firstinits=true]{biblatex}

Related

Pattern Layout to abbreviate the name of all logger components except the 2 rightmost

The following are my favorite patterns
%c{2} - which displays the corresponding number of rightmost logger
name components. So a logger with a name like "org.apache.commons.Foo"
is displayed as "commons.Foo".
and
%c{1.} - which abbreviates the name based on the pattern. So a logger
with a name like "org.apache.commons.Foo" is displayed as "o.a.c.Foo".
Is there a way to combine the two. I want to abbreviate the name of all logger components except the 2 rightmost. Such that "org.apache.commons.Foo" is displayed as "o.a.commons.Foo".
Is it possible to do this using the pattern layout or in any other easy way?
Yes and no. NameAbbreviator.java handles creating the abbreviation of the name. It has a getAbbreviator method that returns one of 3 implementations -
NoOp - returns the string as is.
MaxElement - returns the last n elements.
Pattern - This uses the pattern to break up the string into fragments, formatting each according to the pattern. If you specify 1.2 then the first character of the first item will be printed and 2 characters of each following item will be printed up to the final token, which is never abbreviated. A special case is if the pattern contains a "*". That indicates that everything that follows should be printed as is.
So the answer to your question is that you could use the following patterns:
1.* - would print o.apache.commons.Foo
1.1.* - would print o.a.commons.Foo
As you can see this isn't very helpful when package names have different lengths. I would suggest you create a Jira issue for this. Patches and pull requests are welcome!

How to read out a list of cases in one variable in SPSS and use that to add data?

To explain my problem I use this example data set:
SampleID Date Project Problem
03D00173 03-Dec-2010 1,00
03D00173 03-Dec-2010 1,00
03D00173 28-Sep-2009 YNTRAD
03D00173 28-Sep-2009 YNTRAD
Now, the problem is that I need to replace the text "YNTRAD" with "YNTRAD_PILOT" but only for the cases with Date = 28-Sep-2009.
This is example is part of a much larger database, with many more cases having Project=YNTRAD and Data=28-Sep-2009, so I can not simply select first all cases with 28-Sep-2009, then check which of these cases have Project=YNTRAD and then replace. Instead, what I need to do is:
Look at each case that has a 1,00 in Problem (these are problem
cases)
Then find the SampleID that corresponds with that sample
Then find all other cases with the same SampleID BUT WITH
Date=28-Sep-2009 (this is needed because only those samples are part
of a pilot study) and then replace YNTRAD in Project to
YNTRAD_PILOT.
I read a lot about:
LOOP
- DO REPEAT
- DO IF
but I don't know how to use these in solving this problem.
I first tried making a list containing only the sample ID's that need eventually to be changed (again, this is part of a much larger database).
STRING SampleID2 (A20).
IF (Problem=1) SampleID2=SampleID.
EXECUTE.
AGGREGATE
/OUTFILE=*
/BREAK=SampleID2
/n_SampleID2=N.
This gives a dataset with only the SampleID's for which a change should be made. However I don't know how to read out this dataset case by case and looking up each SampleID in the overall file with all the date and then change only those cases were Date = 28-Sep-2009.
It sounds like once we can identify the IDs that need to be changed we've done the tricky part here. We can use AGGREGATE with MODE=ADDVARIABLES to add a problem Id counter variable to our dataset. From there, it's as you'd expect.
* Add var IdProblemCnt to your database . Stores # of times a given Id had a record with Problem = 1.
AGGREGATE
/OUTFILE=* MODE=ADDVARIABLES
/BREAK=SampleId
/IdProblemCnt=CIN(Problem, 1, 1) .
EXE .
* once we've identified the "problem" Ids we can use `RECODE` Project var.
DO IF (IdProblemCnt>0 AND Date = DATE.MDY(9,28,2009) .
RECODE Project ('YNTRAD' = 'YNTRAD_PILOT') .
END IF .
EXE .

Teradata:Get a specific part of a large variable text field

My first Post: (be kind )
PROBLEM: I need to extract the View Name from a Text field that contains a full SQL Statements so I can link the field a different data source. There are two text strings that always exist on both sides of the target view. I was hoping to use these as identifying "anchors" along with a substring to bring in the View Name text from between them.
EXAMPLE:
from v_mktg_dm.**VIEWNAME** as lead_sql
(UPPER CASE/BOLD is what I want to extract)
I tried using
SELECT
SUBSTR(SQL_FIELD,INSTR(SQL_FIELD,'FROM V_MKTG_TRM_DM.',19),20) AS PARSED_FIELD
FROM DATABASE.SQL_STORAGE_DATA
But am not getting good results -
Any help is appreciated
You can apply a Regular Expression:
RegExp_Substr_gpl(SQL_FIELD, '(v_mktg_dm\.)(.*?)( AS lead_sql)',1,1,'i',2)
This looks for the string between 'v_mktg_dm.' and ' AS lead_sql'.
RegExp_Substr_gpl is an undocumented variation of RegExp_Substr which simplifies the syntax for ignoring parts of the match

how can I add text after an id in a word template with delphi?

I have a "template", a regular word file, and I need to insert text in specific places. I adapted the code from here:
http://www.swissdelphicenter.ch/torry/showcode.php?id=1304
to fit my needs. So I put some identifiers in the word file and used the replace function. It works fine but i can't do that to insert the text of a memo cause it's too big for the word replace function...
In short, i need a way to find an id (#social) and replace that with a large text... I've seen the range function but dont understand how it works. I need an example to get an idea of how to do it, please.
A better way to do Word templates is to insert bookmarks wherever information needs to be added programmatically. In the Word template, simply highlight the range you wish to turn into a bookmark and either use Insert -> Bookmark or press Ctrl+Shift+F5.
Give the bookmark a name and then insert your text like:
var
LWordDoc : WordDocument;
R : WordRange;
// ...open the document, etc
if LWordDoc.Bookmarks.Exists('My Bookmark') then begin
R := LWordDoc.Bookmarks.Item('My Bookmark').Range;
R.InsertAfter('foo');
end else begin
// handle missinng bookmark
end;
Here, using .InsertAfter the text will be added after the bookmark. You can also use any other Range methods or properties, for example R.Text := 'foo'; to substitute the highlighted range with the text you supply.
It is useful to store your bookmark names in some sort of intelligent structure - how you decide to do that is up to you.

How to use a dynamic path expression in Xquery

I'm fairly new to xquery so please bear with me as I try to best ask this question.
when i use the following statement (to select a sequence) it works just fine:
let $parts := doc("soap.xml")/soapenv:Envelope/soapenv:Body/ns0:PartDetails/ns0:partName
this loads all elements (as a sequence) into the $parts variable just how i'd like but...
i want to assign the "/ns0:partName" dynamically. I went thru all the Qname functions thinking they'd somehow help but no such luck. after 2 days of struggling i'm hoping one of you can point me in the right direction.
In your path expression, you can replace element with * and add predicates in order to filter the results, predicates may contain dynamic variables. For example :
*[local-name()=$someName and namespace-uri()=$someURI]
As a simplication to vincent's answer you can just check that an xs:QName matches the node-name() of the node
let $elementName = QName("urn:namespace", "PartDetails")
...
let $parts := doc("soap.xml")/soapenv:Envelope/soapenv:Body/*[node-name() = $elementName]/ns0:PartName

Resources