2017-10-03 15 views
0

numpy docstring 지침에 따라 문서화 문자열을 작성하고 있습니다. 그런 다음 sphinx의 autodoc을 사용하여 내 문서를 생성합니다. 어떤 문서 문자열에서는 LaTeX 수식 (sphinx.ext.mathjax)을 사용하고 있습니다. \r은 새로운 라인과 같은 특별한 것을 의미합니다. 다음 명령을 사용하는 경우 :스핑크스에서 뭔가를 나타낼 수 있습니까?

""" 
This :math:`\langle a, b\rangle` denotes the dot product of a and b 
""" 

제대로 렌더링되지 않습니다. 그것은 새로운 라인에 각도를두고 에러를 내게합니다 : 인라인으로 해석 된 텍스트 또는 구문 참조 시작 문자열 - 끝 문자열없이 \ rangle을 \ langle로 바꾸면 모든 것이 잘 동작합니다. 이 문제를 어떻게 해결할 수 있습니까? 이

r""" 
This :math:`\langle a, b\rangle` denotes the dot product of a and b 
""" 

:

+1

는 스핑크스에 다만 법적 SphinxQL 공간 지금 http://sphinxsearch.com/bugs/view.php?id=332 – planet260

+0

입니다 -'\ r'는 많은 장소에서 캐리지 리턴 문자입니다. 댓글을 위해 – jonrsharpe

+0

@ planet260 thx. 하지만 어떻게하면이 일을 할 수 있을까요? – math

답변

1

솔루션은 이중 슬래시 탈출 또는 삼중 따옴표에서 (따옴표없이)는 "R"을 배치하는 것입니다,이 따옴표 안에 슬래시의 해석을 비활성화 문자열 리터럴의 정의에 영향을 미치는 몇 가지 접두사입니다 (documentation of Python 참조).

관련 발췌 :

The backslash() character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.

및 연구 \

Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters. As a result, in string literals, '\U' and '\u' escapes in raw strings are not treated specially.