Closed dineshadepu closed 6 years ago
There may be other ways of doing this, but I think you also need the caption. Try changing label:src:pcisph_particle_array
to: #+caption: label:src:pcisph_particle_array
and see if that works.
@jagrg is right. Here is a little example of how to do it. You need the src block to be rendered in latex as a float, which requires a caption.
Imagine some text
print('hello')
Later you want to differentiate from Section ref:sec-intro and the src block ref:src-hello. No problem!
Thanks for the quick reply.
I have a problem with pdf export in references while using #+name
.
So I usually avoid it. I get ??
in place of question marks while using #+name
.
Instead using label
, it works fine. But even after adding a #+caption
, it still
refers to subsection, which it is in.
Thank you.
This:
* Introduction label:sec-intro
Imagine some text
* Methods
** A subsection label:se-u
#+name: src-hello
#+caption: Hello, it's me.
#+BEGIN_SRC python :results output org drawer
print('hello')
#+END_SRC
Now, reference a subsection ref:se-u and a src block in Listing ref:src-hello
Renders as this for me:
Right,
But the problem here is there is no label for subsection i.e.,
A subsection doesn't have a label. So the label given for source block is taken by subsection. Is there any work around for that?
Not only that my configuration doesn't get the references for blocks labelled with name. What can I do for it?
My configuration is
(use-package org-ref
:after org
:init
(setq reftex-default-bibliography '("~/Dropbox/Research/references.bib"))
(setq org-ref-bibliography-notes "~/Dropbox/Research/notes/notes.org"
org-ref-default-bibliography '("~/Dropbox/Research/references.bib")
org-ref-pdf-directory "~/Dropbox/papers/")
(setq helm-bibtex-bibliography "~/Dropbox/Research/references.bib")
(setq helm-bibtex-library-path "~/Dropbox/papers/")
(setq helm-bibtex-pdf-open-function
(lambda (fpath)
(start-process "open" "*open*" "open" fpath)))
(setq helm-bibtex-notes-path "~/Dropbox/Research/notes/notes.org")
:config
;; variables that control bibtex key format for auto-generation
;; I want firstauthor-year-title-words
;; this usually makes a legitimate filename to store pdfs under.
(setq bibtex-autokey-year-length 4
bibtex-autokey-name-year-separator "-"
bibtex-autokey-year-title-separator "-"
bibtex-autokey-titleword-separator "-"
bibtex-autokey-titlewords 2
bibtex-autokey-titlewords-stretch 1
bibtex-autokey-titleword-length 5))
;; (setq org-ref-default-ref-type "eqref")
;; (org-defkey org-mode-map ["C-c M-x"] 'org-ref-helm-insert-ref-link)
(use-package doi-utils
:after org)
(use-package org-ref-bibtex
:after org)
;; The following lines are always needed. Choose your own keys.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(use-package ox-reveal
:ensure ox-reveal)
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
(setq org-reveal-mathjax t)
(plist-put org-format-latex-options :scale 1.5)
(add-to-list 'org-latex-packages-alist
'("" "tikz" t))
(setq org-export-latex-hyperref-format "\\ref{%s}")
(org-babel-do-load-languages
'org-babel-load-languages
'(
(shell . t)
(python . t)
(ditaa . t)
(latex . t)
(C . t)
(ipython . t)
))
;; don't ask for security
(defun my-org-confirm-babel-evaluate (lang body)
(not (member lang '("python" "latex" "sh" "ipython"))))
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
(eval-after-load "org"
'(progn
;; .txt files aren't in the list initially, but in case that changes
;; in a future version of org, use if to avoid errors
(if (assoc "\\.txt\\'" org-file-apps)
(setcdr (assoc "\\.txt\\'" org-file-apps) "notepad.exe %s")
(add-to-list 'org-file-apps '("\\.txt\\'" . "notepad.exe %s") t))
;; Change .pdf association directly within the alist
(setcdr (assoc "\\.pdf\\'" org-file-apps) "evince %s")))
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(add-to-list 'company-backends 'company-ob-ipython)
;; (setq org-confirm-babel-evaluate nil) ;don't prompt me to confirm everytime I want to evaluate a block
;;; display/update images in the buffer after I evaluate
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
(add-to-list 'org-latex-minted-langs '(ipython "python"))
(setq org-latex-to-pdf-process (list "latexmk -pdf %f"))
(use-package htmlize
:commands (htmlize-buffer
htmlize-file
htmlize-many-files
htmlize-many-files-dired
htmlize-region))
(setq ob-ipython-resources-dir "~/tmp/")
;; org mode lateX export with reference
(setq org-latex-pdf-process '("latexmk -pdflatex='%latex -shell-escape -interaction nonstopmode' -pdf -output-directory=%o -f %f"))
;; cdlatex mode on
;; (use-package cdlatex
;; :ensure t)
;; (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
;; org latex classes
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("report"
"\\documentclass{report}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
;; (with-eval-after-load 'ox-latex
;; (add-to-list 'org-latex-classes
;; '("phd"
;; "\\documentclass{iitbreport}"
;; ("\\chapter{%s}" . "\\chapter*{%s}")
;; ("\\section{%s}" . "\\section*{%s}")
;; ("\\subsection{%s}" . "\\subsection*{%s}")
;; ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
;; ("\\paragraph{%s}" . "\\paragraph*{%s}")
;; ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("article"
"\\documentclass{myarticle} "
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
(add-to-list 'org-latex-classes
'("iitbreport"
"\\documentclass{iitbreport} "
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(add-to-list 'org-latex-classes
'("asme2ej"
"\\documentclass{asme2ej} "
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(setq org-export-latex-hyperref-format "\\ref{%s}")
(add-to-list 'org-latex-classes
'("koma-article"
"\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
;; (setq org-ref-completion-library 'org-ref-ivy-cite)
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
;; Latex scripts highlight
(setq org-highlight-latex-and-related '(latex))
;; mode specific keys. Org refer a name and label keys shadowing
(add-hook 'org-mode-hook ;; guessing
'(lambda ()
(local-set-key "\C-cr" 'org-ref-helm-insert-ref-link)
(local-set-key "\C-ci" 'org-ref-helm-insert-label-link)))
Do you get the same output as me for the example I listed above?
Can you paste the org and latex that came from your screenshot?
Hi, here is the latex file
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{minted}
\author{dinesh}
\date{\today}
\title{}
\hypersetup{
pdfauthor={dinesh},
pdftitle={},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 25.1.1 (Org mode 9.1.2)},
pdflang={English}}
\begin{document}
\tableofcontents
\section{Introduction \label{sec-intro}}
\label{sec:orgf07281e}
Imagine some text
\section{Methods}
\label{sec:org63961b2}
\subsection{A subsection \label{se-u}}
\label{sec:org0e62461}
\begin{listing}[htbp]
\begin{minted}[]{python}
print('hello')
\end{minted}
\caption{\label{orgf531341}
Hello, it's me.}
\end{listing}
Now, reference a subsection \ref{se-u} and a src block in Listing \ref{src-hello}
\end{document}
Here is the org-pdf converter buffer output.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_IN:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_IN"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_IN").
Latexmk: This is Latexmk, John Collins, 1 January 2015, version: 4.41.
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -shell-escape -interaction nonstopmode -recorder "sample.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./sample.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/myarticle.cls
LaTeX Warning: You have requested document class `myarticle',
but the document class provides `article'.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty))
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/rotating/rotating.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/share/texlive/texmf-dist/tex/latex/capt-of/capt-of.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/latex/minted/minted.sty
(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)
(/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/catchfile.sty)
(./sample.w18)) (/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex))
(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd))
(./_minted-sample/default.pygstyle)/home/dinesh/.virtualenvs/sph/bin/pygmentize
(./sample.aux)
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg))
(./_minted-sample/default-pyg-prefix.pygstyle)
(./_minted-sample/100E360CC768F15A35ED9DDF05E354CEC991994EB823538F975FDABD0880F
1EC.pygtex)
LaTeX Warning: Reference `se-u' on page 1 undefined on input line 51.
LaTeX Warning: Reference `src-hello' on page 1 undefined on input line 51.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./sample.aux)
Package rerunfilecheck Warning: File `sample.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
){/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/share/texmf/
fonts/type1/public/cm-super/sfbx1000.pfb></usr/share/texmf/fonts/type1/public/c
m-super/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb
></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/f
onts/type1/public/cm-super/sftt1000.pfb>
Output written on sample.pdf (1 page, 70155 bytes).
Transcript written on sample.log.
Latexmk: References changed.
Latexmk: References changed.
Latexmk: Log file says output to 'sample.pdf'
Latexmk: List of undefined refs and citations:
Reference `se-u' on page 1 undefined on input line 51
Reference `src-hello' on page 1 undefined on input line 51
Latexmk: Summary of warnings:
Latex failed to resolve 2 reference(s)
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'sample.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -shell-escape -interaction nonstopmode -recorder "sample.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./sample.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/myarticle.cls
LaTeX Warning: You have requested document class `myarticle',
but the document class provides `article'.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty))
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/rotating/rotating.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/share/texlive/texmf-dist/tex/latex/capt-of/capt-of.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/latex/minted/minted.sty
(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)
(/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/catchfile.sty)
(./sample.w18)) (/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex))
(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd))
(./_minted-sample/default.pygstyle)/home/dinesh/.virtualenvs/sph/bin/pygmentize
(./sample.aux)
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./sample.out) (./sample.out)
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg))
(./_minted-sample/default-pyg-prefix.pygstyle) (./sample.toc
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd))
(./_minted-sample/100E360CC768F15A35ED9DDF05E354CEC991994EB823538F975FDABD0880F
1EC.pygtex)
LaTeX Warning: Reference `src-hello' on page 1 undefined on input line 51.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./sample.aux)
LaTeX Warning: There were undefined references.
){/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/share/texmf/
fonts/type1/public/cm-super/sfbx1000.pfb></usr/share/texmf/fonts/type1/public/c
m-super/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb
></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/f
onts/type1/public/cm-super/sftt1000.pfb>
Output written on sample.pdf (1 page, 74327 bytes).
Transcript written on sample.log.
Latexmk: Log file says output to 'sample.pdf'
Latexmk: List of undefined refs and citations:
Reference `src-hello' on page 1 undefined on input line 51
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'sample.out'
'sample.toc'
------------
Run number 3 of rule 'pdflatex'
------------
------------
Running 'pdflatex -shell-escape -interaction nonstopmode -recorder "sample.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./sample.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/myarticle.cls
LaTeX Warning: You have requested document class `myarticle',
but the document class provides `article'.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty))
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/rotating/rotating.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/share/texlive/texmf-dist/tex/latex/capt-of/capt-of.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/latex/minted/minted.sty
(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)
(/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/catchfile.sty)
(./sample.w18)) (/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex))
(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd))
(./_minted-sample/default.pygstyle)/home/dinesh/.virtualenvs/sph/bin/pygmentize
(./sample.aux)
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./sample.out) (./sample.out)
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg))
(./_minted-sample/default-pyg-prefix.pygstyle) (./sample.toc
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd))
(./_minted-sample/100E360CC768F15A35ED9DDF05E354CEC991994EB823538F975FDABD0880F
1EC.pygtex)
LaTeX Warning: Reference `src-hello' on page 1 undefined on input line 51.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./sample.aux)
LaTeX Warning: There were undefined references.
){/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/share/texmf/
fonts/type1/public/cm-super/sfbx1000.pfb></usr/share/texmf/fonts/type1/public/c
m-super/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb
></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/f
onts/type1/public/cm-super/sftt1000.pfb>
Output written on sample.pdf (1 page, 74327 bytes).
Transcript written on sample.log.
Latexmk: Log file says output to 'sample.pdf'
Latexmk: List of undefined refs and citations:
Reference `src-hello' on page 1 undefined on input line 51
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Latexmk: All targets (sample.pdf) are up-to-date
It looks like maybe you need to (setq org-latex-prefer-user-labels t) in your init file.
Perfect! Now it works. Thank you very much.
Hi. Is there a way to keep the count of the sections numbering with the ref:
label when the numbering is set to nil (or a way to hide it in the exported latex but keep the count)? The result is that hyperref deletes the link from the export if I do something like this.
* Methods
:PROPERTIES:
:UNNUMBERED: t
:END:
Also, is there a way to make the code blocks count using letters instead of numbers? since they keep a parallel count with the user labels? since in the example https://github.com/jkitchin/org-ref/issues/545#issuecomment-364661393 if one uses after it ref:sec-intro
the result is that both references are called as 1
I don't understand what you are trying to do. Can you provide an example of what you want and what you get?
#+OPTIONS: toc:nil H:4 num:2
#+LATEX_HEADER: \usepackage{titlesec} \titleformat{\section} {\huge\bfseries\lowercase} {} {0em} {}
#+LATEX_HEADER: \titleformat{\subsection} {\bfseries\large} {$\bullet$} {1em} {}
* Computer Technical skills
:PROPERTIES:
:UNNUMBERED: t
:END:
** Languages
*** programming
C, C++, Haskell, Lisp
*** Markup
${\LaTeX}$, HTML, CSS
* Introduction label:sec-intro
Imagine some text
* 3. Methods
** A subsection label:se-u
#+name: src-hello
#+caption: Hello, it's me.
#+BEGIN_SRC python :results output org drawer
print('hello')
#+END_SRC
Now, reference a subsection **ref:se-u** and a src block in Listing ref:src-hello
but what about **ref:sec-intro**
I still don't understand the problem. You want the first section to be unnumbered, so it should not be part of the count. So, the section you label as labe:sec-intro should start at 1. It is also confusing to me that you you modify the headings in the Latex header so they are not numbered, so the the numbered references in the pdf don't make much sense. If you just remove the unnumbered property, it will be counted. I find it confusing that you have a 3. in the third headline. if you move them around for some reason, that will be incorrect, and require manual fixing.
It is a matter of style, but I would not put org markup for bold around the refs. That is something you would usually let LaTeX manage someway, e.g. a hyperref setting.
Dear, sir. I'm deeply sorry for not making any sense or myself understood. Thank you for all your patience and help. I can do what you suggest with latex but
If I use latex inside the org-mode document I lose features like internal links or I have to write a lot more than I would want. e.g: In the src-hello references so far I have to either:
#+LATEX_HEADER: \usepackage{titlesec} \titleformat{\section} {\huge\bfseries\lowercase} {} {0em} {}[\titlerule]
#+LATEX_HEADER: \usepackage[names, dvipsnames]{xcolor}
#+LATEX_HEADER: \titleformat{\subsection} {\bfseries\large} {$\bullet$} {1em} {}
#+latex_header: \usepackage{hyperref} \hypersetup{colorlinks=true,linkcolor=blue,filecolor=magenta,urlcolor=cyan,citecolor=green,linkequation=yellow}
#+latex_header: \newcommand*{\rsrc}[1]{\begingroup\hypersetup{linkcolor=red}\ref{#1}\endgroup}
\begingroup
\hypersetup{linkcolor=magenta}
\tableofcontents
\endgroup
* Introduction label:sec-intro
Imagine some text
* Computer Technical skills label:sec-cts
** Languages
*** programming
C, C++, Haskell, Lisp
*** Markup
\LaTeX, HTML, CSS
* \thesection{} Methods
** A subsection label:se-u
#+name: src-hello
#+caption: Hello, it's me.
#+BEGIN_SRC python :results output org drawer
print('hello')
#+END_SRC
Now, reference a subsection ref:se-u and a src block in Listing \begingroup\hypersetup{linkcolor=red}ref:src-hello \endgroup
but what about ref:sec-intro and ref:sec-cts also \rsrc{src-hello}
Maybe I've been missing the proper way of doing this exclusively with org-mode's and org-ref's already existing functionalities without me making macros. That's the reason I'm trying to do manual markdown modifications and introducing :properties:
, and all the rest of my nonsense without latex. Since I'm gonna live, breath and eat whichever one (org-mode or rmarkdown) for the next months ahead. I've been testing things. I don't like the idea of writing even more latex than what I already do in rmarkdown.
I still do not get what you are trying to do. Why are you complicating this by using unnumbered sections, not using numbers in the sections, manually numbering one section, and all the latex macros?
You can just use vanilla org-ref ref links for these. You have to provide the context, e.g. in section ref:sec-intro, and section ref:cts. In subsection ref:se-u you will find Listing ref:src-hello, etc.
I don't understand why you need \begingroup..\endgroup for a listing. If it is just to get a red link, then you are mixing styling with content. In that case, you may want to define your own org-mode links that export that way instead of defining latex macros.
That was it! Thank you very very much. I defined new links in org-mode for styling and now use vanilla org-ref links. 😅 Sorry for all the confusing stuff.
Hi,
I have been using org-ref to write my thesis. As part of referring sub sections and source code at other place I frequently go into problem.
Here I labelled a source code in python. When I refer it, the reference actually points to the subsection of the source code. I tried to debug it, I figured out that If the label of the subsection is nil, then source code label is taken by the subsection.
Example code is,
`* Creating particle array An overview is shown in ref:src:pcisph_particle_array**
` In the example, I actually want to refer source code, but it refers to subsection Create particle array. This gets repeated for chapters, sections and where ever I don't prescribe a label. How to fix this?
Thank you.