web-dev-qa-db-ja.com

Mac OS XでPDFlatexを使用してLaTeXドキュメントタイプセットのローカルファイルにリンクするにはどうすればよいですか?

\href{file://./path-to-file}{filename}を介してローカルファイルへのリンクをLaTeXドキュメントに埋め込もうとすると、リモートリンクとしてタイプセットされるため、http://が先頭に追加されます。生成されたPDF)の場所を基準にしたパスを使用して、ローカルファイルにリンクするにはどうすればよいですか?

1
aresnick

uRLを\urlタグに入れることができるはずです。

\url{file://./path-to-file}

pdflatexは(私は)正しいことをするので、結果のPDFにリンクとして表示されます。コンピュータがファイルを開く方法を知っているかどうかは別の問題です。

2
Tim

Windowsでは、この形式はネットワークドライブで機能しました。前面の3つの円記号に注意してください。

\url{file:\\\zfs\\server$\\folder\\sub_folder\\title with spaces_and_underscores.pptx}
1
Matt

\href{run:<file>}を使用してみてください。例えば:

\href{run:./myfile.png}{%

This is the link (Can be also a figure)

} 
  • myfile.png(または任意の拡張子)を.texファイルと同じフォルダーに配置します。
1
np8

私はこれがうまくいくと確信しています:

The test plan is \href{run:test_plan.pdf}{here}.

ファイルtest_plan.pdfが、それを参照するラテックスファイルと同じディレクトリにある場合。

1

\include{}コマンドを試しましたか? \include{chapters/filename}のように、.texファイルを含めることができます。ただし、コマンドに.texを記述しないでください。 StackExchangeネットワークにTeXに関するページがあります。

私のベースTeXプロジェクトは次のようになります。

私のprojectname.tex

\input{header}
\begin{document}
\hyphenation{}          % Words where LaTex-hyphenation fails 
\maketitle          % Creates a page with the title
\newpage
%  \onehalfspacing              % This uses the package setspace
\tableofcontents        % This creates the table of contents
\include{chapter/acronym}   % Acronyms i use
\include{chapter/chapter_1}
% ...
\include{chapter/chapter_n}

\include{chapter/glossary}  % My glossary
\bibliography{bibliography/bibliography}  % Literature database
\end{document}

Chapter_x.texは次のようになります。

\section[section short title]{section title}

そして私のheader.texは次のようになります:

%
% Document preamble
%
  \documentclass[  %
    12pt,          % default font size
    a4paper,       % papersize
    twoside,       % printout will be two sided
%    txt,           % 
    ]{article}

  \usepackage{ulem}          % all words have the underline at the same height \uline statt \underline

  \usepackage[     %
    T1             % T1 font has european sigs
    ]{fontenc}

  \usepackage[     %
    utf8           % Depends on the operating system
    ]{inputenc}    %

  \usepackage[     %
    dvips,         %
    usenames       % allows to use blue yellow etc for font colors
    ]{color}

  \usepackage{hyperref} % allows hyperlings in the table of contents

  \usepackage{amsmath} % math stuff
  \usepackage{amssymb}  % even more math stuff
  \usepackage{extpfeil}
  \usepackage[     % 
    style=long,   % 
%    toc=true,      % Boolean; if true the glossary will be shown in the table of contents
    hypertoc=true, % Hyperlinks in the glossary
    hyper=true,    % 
    number=none,   % 
    acronym=true   % 
    ]{glossary}
  \setacronymnamefmt{\gloshort}

  \usepackage{makeidx}
%  \usepackage{xymtexps}
%  \usepackage{cite} % Used for citing
  \usepackage{bibgerm}
  \usepackage[numbers,square]{natbib}
  \bibliographystyle{dinat}
  \usepackage{textcomp} % Allows to set a ° for example
  \usepackage[     % 
    german         % You may not need this *g*
    ]{babel}

  \usepackage{setspace} % allows to easily change the space between lines
  \usepackage{pstricks} % Used to create graphs
  \usepackage{pst-plot} % Used to create graphs

  \renewcommand{\acronymname}{Abkürzungsverzeichnis} % Sets the name for acronymepage (I'm from germany)
  \makeindex
  \makeacronym
  \makeglossary


  \author{Autor name}
  \title{Document title}
  \date{\copyright\ \today}

この設定は私にとってはうまくいきます。

ファイルのコメントのタイプミスでごめんなさい。私はドイツ語からコメントを翻訳したばかりですが、怠惰すぎて修正できませんg

0
Darokthar

ネットワーク上のディレクトリにアクセスしたい場合は、\ hrefコマンドが機能します。Windowsシステムでもバックスラッシュではなくスラッシュを使用してください。

リンクをPDFやファイルではなくディレクトリにのみ送信する場合は、最後のスラッシュの後にを追加することを忘れないでください。

\href{//netwrok/path-to-your-dir/.}{ex: click here}

ドキュメントのこの行をご覧ください。 ここを参照

0
Karim Sherif