0

I would appreciate your assistance on how to make the in-text citation be (author, n.d.) instead of (author, nd) for references with no date. Strange thing is that n.d. is showing in my reference list only. Here is an example of the entry I use:

@misc{grace.ordinal,
author = {Grace-Martin, Karen},
year ={{n.d.}},
title = {{Principal Component Analysis for Ordinal Scale Items}},
note  = {\url{https://www.theanalysisfactor.com/principal-component-analysis-for-ordinal-scale-items/}, (accessed October 7, 2019)},
}

the package is:

\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}

and the bibliography style is Chicago.

These are the closest answers I found on the website, but my experience with editing the .bst file is zero and I am worried it would mess up my whole thesis on overleaf. Plus, the answer is based on apalike style. Would following it be safe and give the same outcome?

References with n.d. (no date) using natbib with apalike

Where to find apacite.bst file to change bibliography style

Please note I have tried to keep the year field empty, removed the year field altogether but I am not getting what I want. Actually, if I do these two options the authors' name is copied in the date field as well for in-text citation, i.e. (author, author).

update:@Marjin, in case you might have time to have a look at the whole entry, here it is (I was wondering if it is not working because I am using chapterbib and sectionbib?

\documentclass[oneside,12pt]{report}
\usepackage[paper=a4paper,   
        left=3.5cm,
        right=2.5cm,
        top=2.5cm,
        bottom=2.5cm,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{svg}

\usepackage{setspace} \usepackage [T1 ]{ fontenc } \usepackage{arabtex} \usepackage{epigraph} \usepackage{float} \usepackage{caption} \usepackage{subcaption} \usepackage{tabularx} \usepackage{booktabs,caption} \usepackage[flushleft]{threeparttable} \usepackage{float} \usepackage{multirow} \usepackage{setspace} %\usepackage{hyperref} \usepackage[hyphens]{url} \usepackage[hidelinks]{hyperref} \hypersetup{breaklinks=true, colorlinks=true, citecolor=blue, }

\newcommand{\ndlink}[1]{% \begingroup% \hypersetup{linkcolor=blue}% (\hyperlink{cite.#1}{n.d.})% \endgroup}

\urlstyle{same} \renewcommand{\baselinestretch}{1.1} \usepackage[sectionbib]{natbib} \usepackage{chapterbib}

\usepackage{amsmath,amsthm}

\hypersetup{ colorlinks=false, breaklinks=true } \setcounter{secnumdepth}{1} \setcounter{tocdepth}{1}

%discourages hyphenated words at end of lines \hyphenpenalty=5000 \tolerance=1000

\usepackage{appendix}

\appendixpageoff

\usepackage{datetime} \newdateformat{monthyeardate}{% \monthname[\THEMONTH], \THEYEAR}

\newcommand{\quickwordcount}[1]{% \immediate\write18{texcount -0 -sum -merge #1.tex > #1-words.sum }% \input{#1-words.sum}% }

\newcommand\thesistitle{XXXXXX} \newcommand\authorname{XX XX} % Full name \newcommand\authordegrees{XX, XX} % This does not have to be filled in, but the regulations state that you should include any degrees you have.

\newgeometry{left=35mm, right=25mm, top=25mm, bottom=25mm, includeheadfoot} % This has to come before the header and footer information

% HEADER AND FOOTER STYLE % https://en.wikibooks.org/wiki/LaTeX/Customizing_Page_Headers_and_Footers \usepackage{fancyhdr} \setlength{\headheight}{15pt} % For preamble \fancypagestyle{preamble}{ % \fancyhf{} % remove everything \fancyfoot[C]{\thepage} \renewcommand{\headrulewidth}{0pt} % remove lines as well \renewcommand{\footrulewidth}{0pt} } \pagestyle{preamble}

% For the main pages \fancypagestyle{main}{ \fancyhf{} %\fancyhead[R]{\thepage} \fancyfoot[C]{\thepage} %\fancyhead[L]{\textit{ \nouppercase{\leftmark}} } \fancyhead[R]{\textit{ \nouppercase{\rightmark}} } \renewcommand{\headrulewidth}{1pt} % remove lines as well \renewcommand{\footrulewidth}{0pt} }

% For title and chapter pages \fancypagestyle{plain}{ % \fancyhf{} % remove everything \fancyfoot[C]{\thepage} %should keep page number \renewcommand{\headrulewidth}{0pt} % remove lines as well \renewcommand{\footrulewidth}{0pt} }

\begin{document} Some content

\end{document}

Then within each chapter tex file I included at the end of the document before the appendix

\clearpage
\newpage
\bibliography{nameofbibfile}
\bibliographystyle{chicago}
Afnan
  • 3

1 Answers1

0

For a simple one-off workaround you can use \citeauthor, whioch just prints the author, and add the (n.d.) manually, as follows:

\citeauthor{grace.ordinal} (n.d.)

If you use hyperref to create links then this text would not be linked. You can add a link manually using \hyperlink{destionation}{link text}. The destination for cite items is cite.bibtex key, in this case cite.grace.ordinal. Note that this syntax may not be guaranteed for different setups so check carefully if it works. Then you get:

\citeauthor{grace.ordinal} (\hyperlink{cite.grace.ordinal}{n.d.})

To simplify this warkaround you can create a new command. Then you can also do some housekeeping, such as making sure the link color is the same as the cite color and creating a group to prevent leaking the color change into the rest of the document.

An even easier workaround of course is to add the year.

MWE:

@misc{grace.ordinal,
author = {Grace-Martin, Karen},
year ={{n.d.}},
title = {{Principal Component Analysis for Ordinal Scale Items}},
note  = {\url{https://www.theanalysisfactor.com/principal-component-analysis-for-ordinal-scale-items/}, (accessed October 7, 2019)},
}

@misc{gracetwo, author = {Grace-Martin, Karen}, year ={2018}, title = {{Principal Component Analysis for Ordinal Scale Items}}, note = {\url{https://www.theanalysisfactor.com/principal-component-analysis-for-ordinal-scale-items/}, (accessed October 7, 2019)}, }

\documentclass{article}
\usepackage{natbib}
\usepackage[colorlinks,citecolor=blue]{hyperref}
\newcommand{\ndlink}[1]{%
\begingroup%
\hypersetup{linkcolor=blue}%
(\hyperlink{cite.#1}{n.d.})%
\endgroup}
\begin{document}
This is a blog post: \citeauthor{grace.ordinal} \ndlink{grace.ordinal}. The same: \cite{gracetwo}.
\bibliographystyle{chicago}
\bibliography{\jobname}
\end{document}

Result:

enter image description here


With the chapterbib package the link targets have the string @-[chapter number] at the end, e.g., cite.grace.ordinal@-1. You can add this to the command:

\newcommand{\ndlink}[1]{%
\begingroup%
\hypersetup{linkcolor=blue}%
(\hyperlink{cite.#1@-\arabic{chapter}}{n.d.})%
\endgroup}

An easy way to check the link target is to open the pdf in a web browser and hover over an existing bibliography link, then the full link will be displayed in the bottom left corner.

Marijn
  • 37,699
  • Thanks a lot Marjin, I really appreciate your timely assistance and the different options you suggested. I have been trying both ways and sadly the n.d. takes me to the cover page not to the hyperlink. I have tried moving the packages around but still the problem persists. I think I will do it as you suggested but keep the n.d. without a hyperlink to the reference page. So for these citations for which I have no date, it will be only by author that we can go to the reference list. – Afnan Jul 02 '22 at 01:22
  • @Afnan maybe because of chapterbib/sectionbib the hyperlink targets get a different name. I tried with your code in your answer below (please move the code to your question in an edit!) but it still works for me. The code does not have a chapter or a separate bibliography in a chapter or section though (it does not have a bibliography at all) so I can't test what your situation is exactly. You can do two things: 1. check if my small example document in my answer above works for you. 2. modify your own example code to make sure it doesn't work and post that exact non-working code [...] – Marijn Jul 02 '22 at 05:12
  • [...] including the commands for entering the bibliography, as an edit to your question. The way I found the name of the link was to hold the mouse over the author part (which already is a link) and wait 2-3 seconds, then the full link is displayed in the left bottom corner of the browser (this works in Firefox or Chrome, possibly in other browsers as well). Maybe you can use that to modify the command or make individual links. – Marijn Jul 02 '22 at 05:18
  • By the way if your problem is not yet solved you should not add the Accept mark to this answer. If an answer is not accepted then other people may try to answer (for example with a way to modify the .bst file directly). You can remove the accept mark by clicking on it again. – Marijn Jul 02 '22 at 05:20
  • Thanks a lot Marjin, it worked now using the manual hyperlink option in your answer above. I did as you said to find the name of the link, it was cite.grace.ordinal@-1 so for each chapter I had to add @-(# of the chapter). I really appreciate your help!!! How can I accept the comment along with the answer to let others know that this is how it worked? all the best. – Afnan Jul 02 '22 at 11:47
  • @Afnan you cannot accept comments - however I added the missing information about chapterbib to the answer. – Marijn Jul 03 '22 at 11:39
  • @Marjim, I accepted the answer. Thanks a lot for your patience and answer, I hope others would benefit from this. – Afnan Jul 04 '22 at 00:35