-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\markdownInput
ignores \input@path
and TEXMFPATH
#429
Comments
Hi and thanks for using the Markdown package for TeX.
I agree that having the
In TeX, opening a file for reading searches the different
Can you please be more specific? What is odd-looking about the output? What message about unescaped |
\markdownInput
ignores \input@path
and TEXMFPATH
Thank you for making this package; being able to use Markdown in my project will be a significant feature.
I would certainly find it very useful.
All I was trying to say here was that, if you replace I only included this to confirm that the file can be found via |
Ok, I was just wondering if you were perhaps suggesting that |
Oh, please don't patch
|
I have a partial solution on the TeX side; I am sharing it here in case it's useful to anyone coming across the same problem. I feel a solution on the Lua side would be simpler and more efficient, with fewer limitations, but unfortunately I don't know Lua. A new command Limitations:
\documentclass{article}
\NeedsTeXFormat{LaTeX2e}[2020/02/02]
\usepackage{xinttools}% for xintfor*
\usepackage[utf8]{inputenc}
\usepackage{markdown}
\makeatletter
% Define the TeX search path in \input@path (as used by \input etc):
\def\input@path{{/tmp/}}
% Definition of new command \inputMd{}:
\newread\input@read
\newcommand\inputMd[1]{
\IfFileExists{#1}{%
\input@byLines@{#1}
}{%
\errmessage{File `#1' missing!}%
}%
}
\newcommand{\input@processfile}[1]{
\openin\input@read #1\relax
\ifeof\input@read
\closein\input@read
\else
\closein\input@read
\markdownInput{#1}
\fi
}
\newcommand{\input@byLines@}[1]{
\xintFor* ##1 in \input@path\do{
\input@processfile{##1#1}
}
}
\makeatother
% Example usage
\begin{document}
\inputMd{input.md}
\end{document}
|
Thanks for sharing your solution. Here is a somewhat simpler solution using expl3: \ExplSyntaxOn
\newcommand
\inputMd
[ 1 ]
{
\file_get_full_name:nNTF
{ #1 }
\l_tmpa_tl
{
\exp_args:NV
\markdownInput
\l_tmpa_tl
}
{
\errmessage
{ File~`#1'~missing! }
}
}
\ExplSyntaxOff Function |
@robertjlee In commit 0e80a90 from PR #443, I updated I did not add support for \input input.tex
\bye Then, I created an empty file
This leads me to believe that the environmental variable |
Humbly, I was mistaken. Sorry. Having looked at the documentation again, I was confusing The issue should have read There is no variable Thank you for fixing it for |
Thank you for your response. The example document from #429 (comment) works fine with
|
Replication
Based on the following extract from 2.2.1 of the manual, I was expected to be able to use
\markdownInput
on files not in the current directory, as per \input:-So I created 2 files on my system:
/tmp/mbe/mbe.tex
/tmp/input.md
But when I compile it, it can't open the file via
\markdownInput
--- although\input
(while producing odd-looking output and a message about the unescaped#
) works as expected; dumping the contents ofinput.md
as though they were typed in-place.My command-line is
Expected behaviour
Both the setting of
\input@path
, and the setting ofTEXMFPATH
should be sufficient to locate and open the input file.Actual behaviour
The following error message is produced, and the process aborts. The same error is generated if the file is completely missing, making me think this is not a permissions issue.
Use Case Context
I have a document broken up into smaller files, and I am trying to copy the smaller files to a temporary directory to compile them in isolation to extract metadata from them.
Having to track which documents include which other documents is possible, but expensive, and only required when
\markdownInput
- rather than\input
- is used.The text was updated successfully, but these errors were encountered: