I have been assembling long command strings in order to pass large amounts of data into a latex project without having to stage the data first into a csv which slows down the process and can introduce other IO problems. Some of the datasets are much longer than others and I noticed that I was getting this message on just the long ones.
Program 'miktex-pdflatex.exe' failed to run: An error occurred trying to start process '.\miktex-pdflatex.exe' with working directory '.\'. The filename or extension is too long.At line:7 char:5
I did some testing and found that the limit is 32767 chars in the line. This seems to relate to 2^15 = 32768.
For example:
$text = [string]::new('a', 32617)
$state = $true
do{
try {
./miktex-pdflatex.exe -job-name="test" "\documentclass{report}\begin{document}$text\end{document}" -quiet
Write-Progress -Activity "longer command" -Status $text.Length
}
catch {
Write-Warning ("Stopped at " + $text.Length)
$state = $false
}
$text += "b"
}while($state)
This char limit includes the fully resolved path of the exe and all of the flags in addition to the command text.
Is there another way introduce large amounts of data without csv files?
I have been assembling long command strings in order to pass large amounts of data into a latex project without having to stage the data first into a csv which slows down the process and can introduce other IO problems. Some of the datasets are much longer than others and I noticed that I was getting this message on just the long ones.
Program 'miktex-pdflatex.exe' failed to run: An error occurred trying to start process '.\miktex-pdflatex.exe' with working directory '.\'. The filename or extension is too long.At line:7 char:5
I did some testing and found that the limit is 32767 chars in the line. This seems to relate to 2^15 = 32768.
For example:
$text = [string]::new('a', 32617)
$state = $true
do{
try {
./miktex-pdflatex.exe -job-name="test" "\documentclass{report}\begin{document}$text\end{document}" -quiet
Write-Progress -Activity "longer command" -Status $text.Length
}
catch {
Write-Warning ("Stopped at " + $text.Length)
$state = $false
}
$text += "b"
}while($state)
This char limit includes the fully resolved path of the exe and all of the flags in addition to the command text.
Is there another way introduce large amounts of data without csv files?
Share Improve this question edited Mar 11 at 13:07 Craig.C asked Mar 10 at 19:44 Craig.CCraig.C 6015 silver badges17 bronze badges 1- 1 Please improve code formatting to make this easier to answer – Mark Schultheiss Commented Mar 10 at 20:38
1 Answer
Reset to default 0I don't love this solution but it does work. If the text of the command isn't too long it is simply passed to pdflatex as part of the argument string. If it hits a threshold, then I divert the text to a tex file and reference that instead. This gives me a consistent way of avoiding csv files and limiting io.
$Table = ($DeptTransactions | ./Get-TransactionTable.ps1) -join ""
if($Table.Length -gt 30000){
$TempTablePath = "$file`TempTable.tex"
$Table > $TempTablePath
$Table = "\input{$TempTablePath}"
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744826365a4595821.html
评论列表(0条)