比如:
#+name: asdas
#+attr_latex: :float nil
#+caption: RRM interface
#+begin_src cpp
virtual void newDirty(uint64_t address) = 0;
virtual uint8_t newWrite(uint64_t address) = 0;
virtual void update() = 0;
#+end_src
导出得到的是:
\lstset{language=cpp,label=asdas,caption={RRM interface},captionpos=b,numbers=none}
\begin{lstlisting}
virtual void newDirty(uint64_t address) = 0;
virtual uint8_t newWrite(uint64_t address) = 0;
virtual void update() = 0;
\end{lstlisting}
但是我不想要 captionpos=b 的设置,希望它要么不设置,要么设置为t. 我试了 #+attr_latex: :float nil :captionpos t
得到的仍然是 captionpos=b
。除了直接嵌入latex块以外,还能怎么办呢?
有没有试过设置 org-latex-listings-options
?
Nasy
3
#+attr_latex: :options captionpos=t
1 个赞
没有覆盖默认值,得到的是: \lstset{language=cpp,label=asdas,caption={RRM interface},captionpos=b,numbers=none,captionpos=t}
。可以看到它append,但没有 override
试了试, 会添加, 但不会覆盖. 这样设置:
(setq org-latex-listings-options
'(("captionpos" "t")
))
#+name: asdas
#+attr_latex: :float nil
#+caption: RRM interface
#+begin_src cpp
virtual void newDirty(uint64_t address) = 0;
virtual uint8_t newWrite(uint64_t address) = 0;
virtual void update() = 0;
#+end_src
导出结果是:
\lstset{captionpos=t,language=cpp,label=asdas,caption={RRM interface},captionpos=b,numbers=none}
\begin{lstlisting}
virtual void newDirty(uint64_t address) = 0;
virtual uint8_t newWrite(uint64_t address) = 0;
virtual void update() = 0;
\end{lstlisting}