Bibliographystyle Latex - latex

I'm trying to write my article, I need to cite the articles as names of the authors (for one, two and three authors, and use the al if it is more than three), in addition I need the year in parentheses () and not in brackets [], and finally I need to have the references as Last name, first name and not the inverse.
My bibliography file called mybiblio.bib
\documentclass[11pt]{article}
\usepackage[semicolon,square,sectionbib,sort&compress,mcite]{natbib}
\cite{}, \cite*{}...
\bibliographystyle{apalike}
\bibliography{mybiblio.bib}

Related

Custom order on string

I have a project model. Projects have a code attribute, which is in AAXXXX-YY format like "AA0001-18", "ZA0012-19", where AA is two characters, XXXX is a progressive number, and YY is the last two digits of the year of its creation.
I need to define a default scope that orders projects by code in a way that the year takes precedence over the other part. Supposing I have the codes "ZZ0001-17", "AA0001-18", and "ZZ002-17", "ZZ001-17" is first, "ZZ002-17" is second, and "AA001-18" is third.
I tried:
default_scope { order(:code) }
but I get "AA001-18" first.
Short answer
order("substring(code from '..$') ASC, code ASC")
Wait but why?
So as you said, you want to basically sort by 2 things:
the last 2 characters in the code string. YY
the rest of the code AAXXXX-
So first things first,
the order function as per Rails documentation will take the arguments you added and use them in the ORDER BY clause of the query.
Then, the substring function according to the documentation of PostgreSQL is:
substring(string from pattern)
If we want 2 characters .. from the end of the string $ we use ..$
Hence, substring(code from '..$')
For more information about pattern matching please refer to the documentation here.
Now finally, with the second part of our ordering the code which already will act as a sorter for all the preceding characters AAXXXX-.

referencing latex document in order of appearance

Suppose I have an ordered bibliography list
\bibitem{1} biblio 1
\bibitem{2} biblio 2
\bibitem{3} biblio 3
and suppose the first line in my text refers to biblio 3. Is there a way to make the refs follows the order of appearance or am I suppose to reorder the whole bibitems ?
Your new friend is bibtex or biblatex (the second is my pref.). The automatic order of references is just the top of the ice berg.
https://www.ctan.org/pkg/bibtex
https://www.ctan.org/pkg/biblatex

Replace a exact string using Regex in ruby

Consider the the following text
The capital asset as defined in section 2(14) is an exhaustive definition which encompasses all properties of any kind with certain exceptions but the key word is that the property should be "held" section 2.
Now I want to find section 2, for the same I have written the following Regex:
/\bsection+\.*\s+2\b/i
But it is also matching section 2 of section 2(14). I just want it to only match the exact text, not the part of text which is matching with the regex. I know I need to modify the regex, but what are the changes required?
Try with \bsection+\.*\s+2([ .,;?|!])/i . This will only match with section 2 if it is followed by a space or a punctuation mark different than (.
/\bsection+.*\s+2\b([[:punct:]]|\s/
basically you would want the word to end with whitespace or a punctuation.

Automatically abbreviate authors' first names in 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}

include the word "table" in List of Tables, "Appendix" in Table of Contents, etc

I need to include the word "Table" at the beginning of each line in my List of Tables. That is, instead of:
LIST OF TABLES
1 The first table ........... 10
2 The second table ........... 20
I need it to say:
LIST OF TABLES
Table 1 The first table ........... 10
Table 2 The second table ........... 20
Yes, I know that's ugly, but those are the rules.
I also need the Table of contents to say:
Table of Contents
1 The first Chapter ...... 1
Appendices
Appendix A The A appendix ........ 10
Any idea how to do this in a simple and consistent manner?
To answer your three questions:
1: Table prefix in the list of tables put the following in your preamble:
\usepackage{tocloft}
\newlength\tablelen
\settowidth\tablelen{Table}
\addtolength\cfttabnumwidth{\tablelen}
\renewcommand\cfttabpresnum{Table }
2: To have "Appendices" appear in your table of contents put the following just after your call to \appendix:
\addcontentsline{toc}{chapter}{Appendices}
3: To have "Appendix" as a prefix for each appendix in the table of contents, see:
http://for.mat.bham.ac.uk/pgweb/thesisfiles/bhamthesisman.pdf
http://for.mat.bham.ac.uk/pgweb/thesisfiles/bhamthesis.dtx
in particular, search for his \renewcommand{\appendix} in which add to contents is changed.
The easier way is to replace the word \listoftables with
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\listoftables%
}

Resources