Git Product home page Git Product logo

hardwrap's People

Contributors

godbyk avatar wspr avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hardwrap's Issues

Add 'make test' target to run tests

[Incidentally, qstest looks quite useful. I've been meaning to find a testing framework for my LaTeX cocde for quite a while now. I'll have to explore qstest some more.]

Filtering out "bad" commands

Would be good to take care of ~, \par, etc, à la hyperref's bookmark string transformations. This is a bit open-ended and no need to go overboard.

Looks like the package to use for that is Heiko's stringenc.

Message cannot end with newline

Courtesy Ulrich Diez:

\documentclass{article}
\usepackage{hardwrap}
\begin{document}
% Test A  (OK) :
\HardWrap{\message}{15}{\HardWrapSetup}{^^J}{Test\\Test\\Test}
% Test B  (Problem) :
\HardWrap{\message}{15}{\HardWrapSetup}{^^J}{Test\\Test\\}
\end{document}

\GenerateLogMacros{expl3}

Providing hard-wrapped wrappers for the expl3 notification system would be a good extension for the package.

One day hardwrap might make it into LaTeX3 internally (if it works well and people seem to use it), but until then co-existing would nice.

Error messages fall into infinite loop

Test case:

\documentclass{article}
\usepackage{hardwrap}
\GeneratePackageLogMacros{pkg}
\begin{document}
\makeatletter
\pkg@error{Error text.}{More error text.}
\makeatother
\end{document}

After hitting Ctrl+C, the following message is shown:

\hw@wrappedtext ->\hw@protected@newline 
                                        Error\space text.
l.11 \pkg@error{Error text.}{More error text.}

Spaces are collapsed

Normally you'd write \space\space\space to write three spaces in a row. This doesn't work because they're expanded at which point they collapse. Need to locally define \space as \protected to avoid this.

Should the generate macro be renamed?

I haven't really warmed to the names of:

\GeneratePackageLogMacros[prefix]{name}
\GenerateClassLogMacros[prefix]{name}

I sort of think that these might be slightly easier to remember/mentally-parse:

\GenerateLogMacros{Package}[prefix]{name}
\GenerateLogMacros{Class}[prefix]{name}

What do you think?

hardwrap is incompatible with xelatex

When attempting to compile a document with xelatex, I get the following error:

! Undefined control sequence.
l.48   \ifnum\pdfshellescape
                            >0\relax

We should probably account for this possibility.

Indentation

I often need to display supplementary information in a message that looks good if it's indented or whatever. So rather than writing \space\spaces\space it'd be nice to have something like \indent that takes care of this for us.

Braced material is kinda broken

\begin{qstest}{braced material is a pain}{}
\HardWrap{\xdef\TMP}{50}{}{NEWLINE}{AAA {\LIPSUM} ZZZ}%
\Expect*{\TMP}
  *{}
\end{qstest}

Not sure what the expected behaviour here should be.

\pkg@error{x}{x} prints '\MessageBreak x'

Here's the test case:

\GeneratePackageLogMacros{test}
\test@error{x}{x}

Output is:

! Package test Error: \MessageBreak x.

Similarly for the class version.

(info and warning appear okay, though.

Replace `\PackageError`, etc., entirely

There's no reason, necessarily, to keep LaTeX's \PackageError. We could write an entirely separate command with the same functionality but formatted as we like. E.g., in expl3 I've just started experimenting with output for error messages that looks like

................................................
.
! fontspec error "unknown-options"
.
. The following font options are not recognised:
.      foo
.
. For immediate help type H
.
...............................................

`\pkg@warning{\protect\LaTeX}` emits `\protect\LaTeX`

Test case:

\GeneratePackageLogMacros{pkg}
\pkg@warning{\protect\LaTeX}

Result:

Package pkg Warning: \protect \LaTeX 

Expected result:

Package pkg Warning: \LaTeX

(Why package authors don't just use \string\blah and make my life simpler, I don't know.)

\PackageNote, \PackageNoteNoLine, \ClassNote, and \ClassNoteNoLine equivalents missing

LATEX News Issue 34, November 2021:

"\PackageNote and \ClassNote added LATEX offers these three commands: \PackageError to signal errors that stop the processing; \PackageWarning to generate a warning message on the terminal but continue with the processing; and \PackageInfo to provide some information that is only written to the .log file but not sent to the terminal. What has not existed up to now is a way to provide information on the terminal that identifies itself as coming from a specific package but which does not claim to be a warning. (Packages that wanted to write to the terminal used \PackageWarning even though the information was not in fact a warning.) We have therefore now added \PackageNote (and the closely related \PackageNoteNoLine); these identify themselves as “informational”, but they still go to the terminal and not only to the .log file. Similar commands exist for classes and so there too we have new commands: \ClassNote and \ClassNoteNoLine. (github issue 613)"

Hardwrap is missing the equivalents for \PackageNote, \PackageNoteNoLine, \ClassNote, and \ClassNoteNoLine.

Nitpicking

Nitpicking:

  • Documentation, §6 Support: please replace "http" by "https".
  • code line 13: \RequirePackage{ifxetex} please replace obsolete call to ifxetex with the recent iftex package.
  • 2011/02/12, new ISO 8601 Date format is 2011-02-12, see LaTeX News Issue 27, April 2017. On the one hand, this would require LaTeX2e format 2017-04-15, but on the other hand we are at the end of 2022 now.

\ifwindows

Code line 41: \ifwindows\else For me this looks like the documentation "This only works for pdfTEX in TEX Live." is missing an "on Windows". Additionally: If I execute kpsewhich -var-value=max_print_line at the command prompt I get
105% default: max_print_line = 79; arbitrary
Looking into my texmf.cnf file I read:
max_print_line = 105% default: max_print_line = 79; arbitrary
Thus, it would also work on Windows. OK, on Windows, where Cygwin is installed and added to the path. Would be nice if this could be regarded.
For me

\usepackage{hardwrap}
\makeatletter
\setmaxprintline{\@@input"|kpsewhich -var-value=max_print_line"\relax}
\makeatother

works (\showthe\hw@maxprintline says 105), but breaks portability of the document to other computers without Cygwin@Windows.
Note: I am not compiling under Cygwin at all, it is just installed.

Passing \noexpand\macroname to \pkg@warning fails

The following generates an error:

\GeneratePackageLogMacros{mypkg}
\mypkg@warning{Testing \noexpand\textbf.}% should output 'Testing \textbf.'

Some existing packages use \noexpand\macroname to achieve the effect of printing '\macroname' verbatim to the log file.

Should manual newlines be disallowed?

Perhaps if the user enters ^^J to insert a newline, these should be replaced by their "hardwrap newline" equivalent. This would probably make transitioning a little easier, too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.