Correct word-count of a LaTeX document

前端 未结 9 1190
野的像风
野的像风 2021-01-30 01:37

I\'m currently searching for an application or a script that does a correct word count for a LaTeX document.

Up till now, I have only encountered script

相关标签:
9条回答
  • 2021-01-30 02:10
    latex file.tex
    dvips -o - file.dvi | ps2ascii | wc -w
    

    should give you a fairly accurate word count.

    0 讨论(0)
  • 2021-01-30 02:13

    I went with icio's comment and did a word-count on the pdf itself by piping the output of pdftotext to wc:

    pdftotext file.pdf - | wc - w 
    
    0 讨论(0)
  • 2021-01-30 02:16

    If the use of a vim plugin suits you, the vimtex plugin has integrated the texcount tool quite nicely.

    Here is an excerpt from their documentation:

    :VimtexCountLetters       Shows the number of letters/characters or words in
    :VimtexCountWords         the current project or in the selected region. The
                              count is created with `texcount` through a call on
                              the main project file similar to: >
    
                                texcount -nosub -sum [-letter] -merge -q -1 FILE
    <
                              Note: Default arguments may be controlled with
                                    |g:vimtex_texcount_custom_arg|.
    
                              Note: One may access the information through the
                                    function `vimtex#misc#wordcount(opts)`, where
                                    `opts` is a dictionary with the following
                                    keys (defaults indicated): >
    
                                    'range' : [1, line('$')]
                                    'count_letters' : 0/1
                                    'detailed' : 0
    <
                                    If `detailed` is 0, then it only returns the
                                    total count. This makes it possible to use for
                                    e.g. statusline functions. If the `opts` dict
                                    is not passed, then the defaults are assumed.
    
                                                 *VimtexCountLetters!*
                                                 *VimtexCountWords!*
    :VimtexCountLetters!      Similar to |VimtexCountLetters|/|VimtexCountWords|, but
    :VimtexCountWords!        show separate reports for included files.  I.e.
                              presents the result of: >
    
                                texcount -nosub -sum [-letter] -inc FILE
    <
                                                 *VimtexImapsList*
                                                 *<plug>(vimtex-imaps-list)*
    
    

    The nice part about this is how extensible it is. On top of counting the number of words in your current file, you can make a visual selection (say two or three paragraphs) and then only apply the command to your selection.

    0 讨论(0)
提交回复
热议问题